Changeset 16729 for trunk/FACT++
- Timestamp:
- 06/05/13 20:47:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/temperature.cc
r16469 r16729 3 3 #endif 4 4 5 #include <boost/bind.hpp>6 5 #include <boost/array.hpp> 7 6 … … 15 14 #include "Event.h" 16 15 #include "StateMachineDim.h" 16 #include "StateMachineAsio.h" 17 17 #include "Connection.h" 18 18 #include "LocalControl.h" … … 319 319 320 320 template <class T, class S> 321 class StateMachinePowerControl : public T, public ba::io_service, public ba::io_service::work321 class StateMachinePowerControl : public StateMachineAsio<T> 322 322 { 323 323 private: … … 358 358 int Execute() 359 359 { 360 // Dispatch (execute) at most one handler from the queue. In contrary361 // to run_one(), it doesn't wait until a handler is available362 // which can be dispatched, so poll_one() might return with 0363 // handlers dispatched. The handlers are always dispatched/executed364 // synchronously, i.e. within the call to poll_one()365 poll_one();366 367 360 return fPower.GetState(); 368 361 } … … 371 364 public: 372 365 StateMachinePowerControl(ostream &out=cout) : 373 T(out, "TEMPERATURE"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 374 fPower(*this, *this) 375 { 376 // ba::io_service::work is a kind of keep_alive for the loop. 377 // It prevents the io_service to go to stopped state, which 378 // would prevent any consecutive calls to run() 379 // or poll() to do nothing. reset() could also revoke to the 380 // previous state but this might introduce some overhead of 381 // deletion and creation of threads and more. 382 366 StateMachineAsio<T>(out, "TEMPERATURE"), fPower(*this, *this) 367 { 383 368 // State names 384 369 T::AddStateName(Temperature::State::kDisconnected, "NoConnection",
Note:
See TracChangeset
for help on using the changeset viewer.