mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
DDS Plugin: reset channel containers before filling
This commit is contained in:
parent
44bfbe02ed
commit
dc72262af1
|
@ -100,8 +100,12 @@ DDS::DDS(const string& name,
|
|||
PublishBoundChannels();
|
||||
break;
|
||||
case DeviceState::ResettingDevice: {
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(fUpdateMutex);
|
||||
fUpdatesAllowed = false;
|
||||
}
|
||||
|
||||
EmptyChannelContainers();
|
||||
break;
|
||||
}
|
||||
case DeviceState::Exiting:
|
||||
|
@ -127,13 +131,7 @@ DDS::DDS(const string& name,
|
|||
if (staticMode) {
|
||||
fControllerThread = thread(&DDS::StaticControl, this);
|
||||
} else {
|
||||
fWorkerThread = thread([this]() {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(fUpdateMutex);
|
||||
fUpdateCondition.wait(lk, [&]{ return fUpdatesAllowed; });
|
||||
}
|
||||
fWorkerQueue.run();
|
||||
});
|
||||
StartWorkerThread();
|
||||
}
|
||||
|
||||
fDDS.Start();
|
||||
|
@ -144,6 +142,19 @@ DDS::DDS(const string& name,
|
|||
}
|
||||
}
|
||||
|
||||
void DDS::EmptyChannelContainers()
|
||||
{
|
||||
fBindingChans.clear();
|
||||
fConnectingChans.clear();
|
||||
}
|
||||
|
||||
auto DDS::StartWorkerThread() -> void
|
||||
{
|
||||
fWorkerThread = thread([this]() {
|
||||
fWorkerQueue.run();
|
||||
});
|
||||
}
|
||||
|
||||
auto DDS::WaitForExitingAck() -> void
|
||||
{
|
||||
unique_lock<mutex> lock(fStateChangeSubscriberMutex);
|
||||
|
@ -257,6 +268,10 @@ auto DDS::SubscribeForConnectingChannels() -> void
|
|||
|
||||
boost::asio::post(fWorkerQueue, [=]() {
|
||||
try {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(fUpdateMutex);
|
||||
fUpdateCondition.wait(lk, [&]{ return fUpdatesAllowed; });
|
||||
}
|
||||
string val = value;
|
||||
// check if it is to handle as one out of multiple values
|
||||
auto it = fIofN.find(propertyId);
|
||||
|
|
|
@ -133,8 +133,11 @@ class DDS : public Plugin
|
|||
private:
|
||||
auto StaticControl() -> void;
|
||||
auto WaitForExitingAck() -> void;
|
||||
auto StartWorkerThread() -> void;
|
||||
|
||||
auto FillChannelContainers() -> void;
|
||||
auto EmptyChannelContainers() -> void;
|
||||
|
||||
auto SubscribeForConnectingChannels() -> void;
|
||||
auto PublishBoundChannels() -> void;
|
||||
auto SubscribeForCustomCommands() -> void;
|
||||
|
|
Loading…
Reference in New Issue
Block a user