mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
fix(control): Honor SIGINT and SIGTERM in more places
* Queue next transition for long-running states (fix #421) * Add *OrCustom/Push/Locked family of functions to StateQueue to enable composition with custom signals
This commit is contained in:
committed by
Dennis Klein
parent
27277b11b4
commit
6780b7452c
@@ -290,7 +290,9 @@ void Device::BindWrapper()
|
||||
|
||||
Bind();
|
||||
|
||||
ChangeState(Transition::Auto);
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
void Device::ConnectWrapper()
|
||||
@@ -327,7 +329,9 @@ void Device::ConnectWrapper()
|
||||
|
||||
Connect();
|
||||
|
||||
ChangeState(Transition::Auto);
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
void Device::AttachChannels(vector<Channel*>& chans)
|
||||
@@ -427,7 +431,9 @@ void Device::InitTaskWrapper()
|
||||
{
|
||||
InitTask();
|
||||
|
||||
ChangeState(Transition::Auto);
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
void Device::RunWrapper()
|
||||
@@ -443,6 +449,10 @@ void Device::RunWrapper()
|
||||
if (rateLogging) {
|
||||
rateLogger = make_unique<thread>(&Device::LogSocketRates, this);
|
||||
}
|
||||
tools::CallOnDestruction joinRateLogger([&](){
|
||||
if (rateLogging && rateLogger->joinable()) { rateLogger->join(); }
|
||||
});
|
||||
|
||||
|
||||
// notify transports to resume transfers
|
||||
for (auto& t : fTransports) {
|
||||
@@ -485,10 +495,6 @@ void Device::RunWrapper()
|
||||
PostRun();
|
||||
|
||||
cod.disable();
|
||||
|
||||
if (rateLogging && rateLogger->joinable()) {
|
||||
rateLogger->join();
|
||||
}
|
||||
}
|
||||
|
||||
void Device::HandleSingleChannelInput()
|
||||
@@ -772,7 +778,9 @@ void Device::ResetTaskWrapper()
|
||||
{
|
||||
ResetTask();
|
||||
|
||||
ChangeState(Transition::Auto);
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
void Device::ResetWrapper()
|
||||
@@ -786,7 +794,9 @@ void Device::ResetWrapper()
|
||||
fChannels.clear();
|
||||
fTransports.clear();
|
||||
fTransportFactory.reset();
|
||||
ChangeState(Transition::Auto);
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
}
|
||||
}
|
||||
|
||||
Device::~Device()
|
||||
|
Reference in New Issue
Block a user