Changeset 16727 for trunk/FACT++/src/tngweather.cc
- Timestamp:
- 06/05/13 20:36:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/tngweather.cc
r14978 r16727 1 #include <boost/bind.hpp>2 1 #include <boost/array.hpp> 3 2 … … 11 10 #include "Shell.h" 12 11 #include "StateMachineDim.h" 12 #include "StateMachineAsio.h" 13 13 #include "Connection.h" 14 14 #include "LocalControl.h" … … 407 407 408 408 template <class T, class S> 409 class StateMachineWeather : public T, public ba::io_service, public ba::io_service::work409 class StateMachineWeather : public StateMachineAsio<T> 410 410 { 411 411 private: … … 461 461 int Execute() 462 462 { 463 // Dispatch (execute) at most one handler from the queue. In contrary464 // to run_one(), it doesn't wait until a handler is available465 // which can be dispatched, so poll_one() might return with 0466 // handlers dispatched. The handlers are always dispatched/executed467 // synchronously, i.e. within the call to poll_one()468 poll_one();469 470 463 return fWeather.GetState(); 471 464 } … … 474 467 public: 475 468 StateMachineWeather(ostream &out=cout) : 476 T(out, "TNG_WEATHER"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 477 fWeather(*this, *this) 478 { 479 // ba::io_service::work is a kind of keep_alive for the loop. 480 // It prevents the io_service to go to stopped state, which 481 // would prevent any consecutive calls to run() 482 // or poll() to do nothing. reset() could also revoke to the 483 // previous state but this might introduce some overhead of 484 // deletion and creation of threads and more. 485 469 StateMachineAsio<T>(out, "TNG_WEATHER"), fWeather(*this, *this) 470 { 486 471 // State names 487 472 T::AddStateName(State::kDisconnected, "NoConnection",
Note:
See TracChangeset
for help on using the changeset viewer.