Changeset 16731 for trunk/FACT++
- Timestamp:
- 06/05/13 21:16:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fscctrl.cc
r15443 r16731 5 5 #include "Shell.h" 6 6 #include "StateMachineDim.h" 7 #include "StateMachineAsio.h" 7 8 #include "Connection.h" 8 9 #include "LocalControl.h" … … 716 717 717 718 template <class T, class S> 718 class StateMachineFSC : public T, public ba::io_service, public ba::io_service::work719 class StateMachineFSC : public StateMachineAsio<T> 719 720 { 720 721 private: … … 726 727 fFSC.PostClose(false); 727 728 728 /*729 // Now wait until all connection have been closed and730 // all pending handlers have been processed731 poll();732 */733 734 729 return T::GetCurrentState(); 735 730 } … … 742 737 // Now wait until all connection have been closed and 743 738 // all pending handlers have been processed 744 poll();739 ba::io_service::poll(); 745 740 746 741 if (evt.GetBool()) … … 755 750 int Execute() 756 751 { 757 // Dispatch (execute) at most one handler from the queue. In contrary758 // to run_one(), it doesn't wait until a handler is available759 // which can be dispatched, so poll_one() might return with 0760 // handlers dispatched. The handlers are always dispatched/executed761 // synchronously, i.e. within the call to poll_one()762 poll_one();763 764 752 return fFSC.IsConnected() ? State::kConnected : State::kDisconnected; 765 753 } … … 798 786 public: 799 787 StateMachineFSC(ostream &out=cout) : 800 T(out, "FSC_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 801 fFSC(*this, *this) 802 { 803 // ba::io_service::work is a kind of keep_alive for the loop. 804 // It prevents the io_service to go to stopped state, which 805 // would prevent any consecutive calls to run() 806 // or poll() to do nothing. reset() could also revoke to the 807 // previous state but this might introduce some overhead of 808 // deletion and creation of threads and more. 809 788 StateMachineAsio<T>(out, "FSC_CONTROL"), fFSC(*this, *this) 789 { 810 790 // State names 811 791 T::AddStateName(State::kDisconnected, "Disconnected",
Note:
See TracChangeset
for help on using the changeset viewer.