General purpose asynchronous timer. More...
#include <timers.hpp>
Public Member Functions | |
| timer () | |
| Standard constructor. | |
| timer (boost::asio::io_service &io) | |
| Construct a timer object using a running io_service object. | |
| template<class Handler > | |
| void | wait (size_t milliseconds, Handler handler) |
| Wait in background a given amount of milliseconds. | |
| ~timer () | |
| Standard destructor, cancels pending operations if handler wasn't called. | |
Private Member Functions | |
| void | run () |
Private Attributes | |
| const bool | holds_fresh_io_service_ |
| boost::asio::io_service * | io_service_ |
| boost::thread * | timer_thread_ |
| boost_timer | timer_ |
General purpose asynchronous timer.
Definition at line 164 of file timers.hpp.
| ana::timer::timer | ( | ) |
Standard constructor.
Creates its own io_service object and runs in its own thread.
Definition at line 75 of file asio_timers.cpp.
| ana::timer::timer | ( | boost::asio::io_service & | io | ) |
Construct a timer object using a running io_service object.
The timer insures it won't stop the io_service.
Definition at line 83 of file asio_timers.cpp.
| ana::timer::~timer | ( | ) |
Standard destructor, cancels pending operations if handler wasn't called.
Definition at line 91 of file asio_timers.cpp.
References holds_fresh_io_service_, io_service_, and timer_thread_.
| void ana::timer::run | ( | ) | [private] |
Definition at line 101 of file asio_timers.cpp.
References holds_fresh_io_service_, and io_service_.
Referenced by wait().

| void ana::timer::wait | ( | size_t | milliseconds, | |
| Handler | handler | |||
| ) | [inline] |
Wait in background a given amount of milliseconds.
The method shouldn't be called with a size_t constant directly. Instead, the user should use the functions in the ana::time namespace.
| milliseconds | : Amount of milliseconds to wait. | |
| handler | : Handler object to handle the timeout event. |
Examples:
Definition at line 199 of file timers.hpp.
References holds_fresh_io_service_, run(), timer_, and timer_thread_.
Referenced by asio_client::start_connection_timer(), ana::detail::timed_sender::start_timer(), ana_multiple_receive_handler::wait_completion(), ana_receive_handler::wait_completion(), and asio_listener::wait_for_incoming_message().


const bool ana::timer::holds_fresh_io_service_ [private] |
Definition at line 215 of file timers.hpp.
boost::asio::io_service* ana::timer::io_service_ [private] |
Definition at line 217 of file timers.hpp.
boost_timer ana::timer::timer_ [private] |
Definition at line 221 of file timers.hpp.
Referenced by wait().
boost::thread* ana::timer::timer_thread_ [private] |
Definition at line 219 of file timers.hpp.
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:18 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |