mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Update state machine
- Split INITIALIZING state into Init+Bind+Connect - Remove PAUSE state - Convert state/transitions to enum classes (CamelCase) - Transition to a state only once previous handler is complete - Add CompleteInit transition to notify Initializing state that config updates are complete - Deprecate WaitForEndOfState(transition) in favor of WaitForState(state)/WaitForNextState() - Update tests/plugins to new APIs - Deprecate CheckCurrentState() in favor of NewStatePending()
This commit is contained in:
committed by
Dennis Klein
parent
5e71d09e4d
commit
fc94342db8
@@ -22,20 +22,26 @@ using namespace std;
|
||||
|
||||
void control(FairMQDevice& device)
|
||||
{
|
||||
device.ChangeState("INIT_DEVICE");
|
||||
device.WaitForEndOfState("INIT_DEVICE");
|
||||
device.ChangeState("INIT_TASK");
|
||||
device.WaitForEndOfState("INIT_TASK");
|
||||
device.ChangeState(fair::mq::Transition::InitDevice);
|
||||
device.WaitForState(fair::mq::State::InitializingDevice);
|
||||
device.ChangeState(fair::mq::Transition::CompleteInit);
|
||||
device.WaitForState(fair::mq::State::Initialized);
|
||||
device.ChangeState(fair::mq::Transition::Bind);
|
||||
device.WaitForState(fair::mq::State::Bound);
|
||||
device.ChangeState(fair::mq::Transition::Connect);
|
||||
device.WaitForState(fair::mq::State::DeviceReady);
|
||||
device.ChangeState(fair::mq::Transition::InitTask);
|
||||
device.WaitForState(fair::mq::State::Ready);
|
||||
|
||||
device.ChangeState("RUN");
|
||||
device.WaitForEndOfState("RUN");
|
||||
device.ChangeState(fair::mq::Transition::Run);
|
||||
device.WaitForState(fair::mq::State::Ready);
|
||||
|
||||
device.ChangeState("RESET_TASK");
|
||||
device.WaitForEndOfState("RESET_TASK");
|
||||
device.ChangeState("RESET_DEVICE");
|
||||
device.WaitForEndOfState("RESET_DEVICE");
|
||||
device.ChangeState(fair::mq::Transition::ResetTask);
|
||||
device.WaitForState(fair::mq::State::DeviceReady);
|
||||
device.ChangeState(fair::mq::Transition::ResetDevice);
|
||||
device.WaitForState(fair::mq::State::Idle);
|
||||
|
||||
device.ChangeState("END");
|
||||
device.ChangeState(fair::mq::Transition::End);
|
||||
}
|
||||
|
||||
class MultipleDevices : public ::testing::Test {
|
||||
@@ -57,8 +63,7 @@ class MultipleDevices : public ::testing::Test {
|
||||
|
||||
sender.RunStateMachine();
|
||||
|
||||
if (t.joinable())
|
||||
{
|
||||
if (t.joinable()) {
|
||||
t.join();
|
||||
}
|
||||
|
||||
@@ -79,8 +84,7 @@ class MultipleDevices : public ::testing::Test {
|
||||
|
||||
receiver.RunStateMachine();
|
||||
|
||||
if (t.joinable())
|
||||
{
|
||||
if (t.joinable()) {
|
||||
t.join();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user