mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Fix regression in the DDS plugin shutdown handling
This commit is contained in:
parent
f6e3183f45
commit
073f5e5c0e
|
@ -87,7 +87,6 @@ DDS::DDS(const string& name,
|
||||||
|
|
||||||
// subscribe to device state changes, pushing new state changes into the event queue
|
// subscribe to device state changes, pushing new state changes into the event queue
|
||||||
SubscribeToDeviceStateChange([&](DeviceState newState) {
|
SubscribeToDeviceStateChange([&](DeviceState newState) {
|
||||||
fStateQueue.Push(newState);
|
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case DeviceState::Bound:
|
case DeviceState::Bound:
|
||||||
// Receive addresses of connecting channels from DDS
|
// Receive addresses of connecting channels from DDS
|
||||||
|
@ -109,7 +108,11 @@ DDS::DDS(const string& name,
|
||||||
}
|
}
|
||||||
case DeviceState::Exiting:
|
case DeviceState::Exiting:
|
||||||
fWorkGuard.reset();
|
fWorkGuard.reset();
|
||||||
fDeviceTerminationRequested = true;
|
{
|
||||||
|
unique_lock<mutex> lock(fStopMutex);
|
||||||
|
fDeviceTerminationRequested = true;
|
||||||
|
}
|
||||||
|
fStopCondition.notify_one();
|
||||||
UnsubscribeFromDeviceStateChange();
|
UnsubscribeFromDeviceStateChange();
|
||||||
ReleaseDeviceControl();
|
ReleaseDeviceControl();
|
||||||
break;
|
break;
|
||||||
|
@ -373,6 +376,7 @@ auto DDS::SubscribeForCustomCommands() -> void
|
||||||
inCmds.Deserialize(cmdStr);
|
inCmds.Deserialize(cmdStr);
|
||||||
|
|
||||||
for (const auto& cmd : inCmds) {
|
for (const auto& cmd : inCmds) {
|
||||||
|
// LOG(info) << "Received command type: '" << cmd->GetType() << "' from " << senderId;
|
||||||
switch (cmd->GetType()) {
|
switch (cmd->GetType()) {
|
||||||
case Type::check_state: {
|
case Type::check_state: {
|
||||||
fDDS.Send(Cmds(make<CurrentState>(id, GetCurrentDeviceState())).Serialize(), to_string(senderId));
|
fDDS.Send(Cmds(make<CurrentState>(id, GetCurrentDeviceState())).Serialize(), to_string(senderId));
|
||||||
|
@ -387,6 +391,10 @@ auto DDS::SubscribeForCustomCommands() -> void
|
||||||
Cmds outCmds(make<TransitionStatus>(id, Result::Failure, transition));
|
Cmds outCmds(make<TransitionStatus>(id, Result::Failure, transition));
|
||||||
fDDS.Send(outCmds.Serialize(), to_string(senderId));
|
fDDS.Send(outCmds.Serialize(), to_string(senderId));
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
lock_guard<mutex> lock{fStateChangeSubscriberMutex};
|
||||||
|
fLastExternalController = senderId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Type::dump_config: {
|
case Type::dump_config: {
|
||||||
|
|
|
@ -161,7 +161,6 @@ class DDS : public Plugin
|
||||||
|
|
||||||
std::thread fControllerThread;
|
std::thread fControllerThread;
|
||||||
DeviceState fCurrentState, fLastState;
|
DeviceState fCurrentState, fLastState;
|
||||||
fair::mq::StateQueue fStateQueue;
|
|
||||||
|
|
||||||
std::atomic<bool> fDeviceTerminationRequested;
|
std::atomic<bool> fDeviceTerminationRequested;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user