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:
Dennis Klein
2022-03-03 21:20:49 +01:00
committed by Dennis Klein
parent 27277b11b4
commit 6780b7452c
5 changed files with 191 additions and 96 deletions

View File

@@ -187,9 +187,7 @@ struct Machine_ : public state_machine_def<Machine_>
{
unique_lock<mutex> lock(fStateMtx);
while (!fNewStatePending) {
fNewStatePendingCV.wait_for(lock, chrono::milliseconds(100));
}
fNewStatePendingCV.wait(lock, [this]{ return fNewStatePending.load(); });
LOG(state) << fState << " ---> " << fNewState;
fState = static_cast<State>(fNewState);