Changeset 16727 for trunk/FACT++/src/lidctrl.cc
- Timestamp:
- 06/05/13 20:36:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/lidctrl.cc
r15122 r16727 1 #include <boost/bind.hpp>2 1 #include <boost/array.hpp> 3 2 … … 12 11 #include "Event.h" 13 12 #include "StateMachineDim.h" 13 #include "StateMachineAsio.h" 14 14 #include "Connection.h" 15 15 #include "LocalControl.h" … … 460 460 461 461 template <class T, class S> 462 class StateMachineLidControl : public T, public ba::io_service, public ba::io_service::work462 class StateMachineLidControl : public StateMachineAsio<T> 463 463 { 464 464 private: … … 529 529 int Execute() 530 530 { 531 // Dispatch (execute) at most one handler from the queue. In contrary532 // to run_one(), it doesn't wait until a handler is available533 // which can be dispatched, so poll_one() might return with 0534 // handlers dispatched. The handlers are always dispatched/executed535 // synchronously, i.e. within the call to poll_one()536 poll_one();537 538 531 const int rc = fLid.GetState(); 539 532 … … 551 544 public: 552 545 StateMachineLidControl(ostream &out=cout) : 553 T(out, "LID_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 554 fLid(*this, *this) 555 { 556 // ba::io_service::work is a kind of keep_alive for the loop. 557 // It prevents the io_service to go to stopped state, which 558 // would prevent any consecutive calls to run() 559 // or poll() to do nothing. reset() could also revoke to the 560 // previous state but this might introduce some overhead of 561 // deletion and creation of threads and more. 562 546 StateMachineAsio<T>(out, "LID_CONTROL"), fLid(*this, *this) 547 { 563 548 // State names 564 549 T::AddStateName(Lid::State::kDisconnected, "NoConnection",
Note:
See TracChangeset
for help on using the changeset viewer.