FACT++  1.0
template<class T>
int StateMachineAsio< T >::Run ( bool  )
inlineprivate

Definition at line 41 of file StateMachineAsio.h.

References StateMachineAsio< T >::Execute(), StateMachineAsio< T >::HandleTrigger(), StateMachineImp::kSM_NotReady, StateMachineImp::kSM_Ready, reset(), and StateMachineAsio< T >::Stop().

42  {
43  fTrigger.expires_from_now(boost::posix_time::microseconds(0));
44  fTrigger.async_wait(boost::bind(&StateMachineAsio::HandleTrigger,
45  this, boost::asio::placeholders::error));
46 
47  T::SetCurrentState(StateMachineImp::kSM_Ready, "by Run()");
48 
49  T::fRunning = true;
50 
51  while (run_one())
52  {
53  if (!T::HandleNewState(Execute(), 0, "by Run()"))
54  Stop(-1);
55  }
56  reset();
57 
58  T::fRunning = false;
59 
60  if (T::fExitRequested==-1)
61  {
62  T::Fatal("Fatal Error occured... shutting down.");
63  return -1;
64  }
65 
66  T::SetCurrentState(StateMachineImp::kSM_NotReady, "due to return from Run().");
67 
68  const int exitcode = T::fExitRequested-1;
69  T::fExitRequested = 0;
70  return exitcode;
71  }
Mainloop running, state machine in operation.
boost::asio::deadline_timer fTrigger
void HandleTrigger(const boost::system::error_code &error)
Mainloop not running, state machine stopped.
void Stop(int code=0)
void reset(S &s)
Definition: ByteOrder.h:13

+ Here is the call graph for this function: