mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
fixes fromreview
This commit is contained in:
parent
26faaa307b
commit
3350e3997e
@ -12,7 +12,7 @@ is listening to.
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
class Arping : private virtual slsDetectorDefs {
|
||||
class Arping {
|
||||
|
||||
public:
|
||||
void SetInterfacesAndIps(const int index, const std::string &interface,
|
||||
@ -31,5 +31,5 @@ class Arping : private virtual slsDetectorDefs {
|
||||
std::vector<std::string>(MAX_NUMBER_OF_LISTENING_THREADS);
|
||||
std::atomic<bool> runningFlag{false};
|
||||
std::thread t;
|
||||
pid_t threadId{0};
|
||||
std::atomic<pid_t> threadId{0};
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "Implementation.h"
|
||||
#include "Arping.h"
|
||||
#include "DataProcessor.h"
|
||||
#include "DataStreamer.h"
|
||||
#include "Fifo.h"
|
||||
@ -109,9 +108,6 @@ void Implementation::SetupFifoStructure() {
|
||||
|
||||
void Implementation::setDetectorType(const detectorType d) {
|
||||
|
||||
// object to create thread for arping
|
||||
arping = sls::make_unique<Arping>();
|
||||
|
||||
detType = d;
|
||||
switch (detType) {
|
||||
case GOTTHARD:
|
||||
@ -325,21 +321,19 @@ std::array<pid_t, NUM_RX_THREAD_IDS> Implementation::getThreadIds() const {
|
||||
retval[id++] = 0;
|
||||
}
|
||||
}
|
||||
retval[NUM_RX_THREAD_IDS - 1] = arping->GetThreadId();
|
||||
retval[NUM_RX_THREAD_IDS - 1] = arping.GetThreadId();
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool Implementation::getArping() const { return arping->IsRunning(); }
|
||||
bool Implementation::getArping() const { return arping.IsRunning(); }
|
||||
|
||||
pid_t Implementation::getArpingThreadId() const {
|
||||
return arping->GetThreadId();
|
||||
}
|
||||
pid_t Implementation::getArpingThreadId() const { return arping.GetThreadId(); }
|
||||
|
||||
void Implementation::setArping(const bool i,
|
||||
const std::vector<std::string> ips) {
|
||||
if (i != arping->IsRunning()) {
|
||||
if (i != arping.IsRunning()) {
|
||||
if (!i) {
|
||||
arping->StopThread();
|
||||
arping.StopThread();
|
||||
} else {
|
||||
// setup interface
|
||||
for (int i = 0; i != numUDPInterfaces; ++i) {
|
||||
@ -347,9 +341,9 @@ void Implementation::setArping(const bool i,
|
||||
if (i == 1 && (numUDPInterfaces == 1 || detType == EIGER)) {
|
||||
break;
|
||||
}
|
||||
arping->SetInterfacesAndIps(i, eth[i], ips[i]);
|
||||
arping.SetInterfacesAndIps(i, eth[i], ips[i]);
|
||||
}
|
||||
arping->StartThread();
|
||||
arping.StartThread();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include "Arping.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "sls/container_utils.h"
|
||||
#include "sls/logger.h"
|
||||
@ -11,7 +12,6 @@ class DataProcessor;
|
||||
class DataStreamer;
|
||||
class Fifo;
|
||||
class slsDetectorDefs;
|
||||
class Arping;
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
@ -383,7 +383,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
std::vector<std::unique_ptr<DataProcessor>> dataProcessor;
|
||||
std::vector<std::unique_ptr<DataStreamer>> dataStreamer;
|
||||
std::vector<std::unique_ptr<Fifo>> fifo;
|
||||
std::unique_ptr<Arping> arping;
|
||||
Arping arping;
|
||||
|
||||
std::mutex hdf5Lib;
|
||||
};
|
||||
|
@ -45,5 +45,5 @@ class ThreadObject : private virtual slsDetectorDefs {
|
||||
std::thread threadObject;
|
||||
sem_t semaphore;
|
||||
const std::string type;
|
||||
pid_t threadId{0};
|
||||
std::atomic<pid_t> threadId{0};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user