CppCMS
|
A timer object. More...
#include <booster/booster/aio/deadline_timer.h>
Public Member Functions | |
deadline_timer () | |
deadline_timer (io_service &srv) | |
io_service & | get_io_service () |
void | set_io_service (io_service &srv) |
void | reset_io_service () |
void | expires_from_now (ptime t) |
ptime | expires_from_now () |
void | expires_at (ptime t) |
ptime | expires_at () |
void | wait () |
void | async_wait (event_handler const &h) |
void | cancel () |
Friends | |
struct | waiter |
A timer object.
booster::aio::deadline_timer::deadline_timer | ( | ) |
Create a new timer object
booster::aio::deadline_timer::deadline_timer | ( | io_service & | srv | ) |
Create a new timer object connected to the io_service srv
void booster::aio::deadline_timer::async_wait | ( | event_handler const & | h | ) |
Wait asynchronously for the timer.
If io_service is not assigned throws system::system_error, all other errors reported via h
void booster::aio::deadline_timer::cancel | ( | ) |
Cancel asynchronous operation. The active handler is immediately scheduled for execution with booster::aio::aio_error::cancel error code in booster::aio::aio_error_cat category.
It allows to distinguish between operation cancellation and normal completion
void booster::aio::deadline_timer::expires_at | ( | ptime | t | ) |
Set an absolute expiration time
If the function is called during the wait operation the behavior is undefined
ptime booster::aio::deadline_timer::expires_at | ( | ) |
Get an absolute expiration time
void booster::aio::deadline_timer::expires_from_now | ( | ptime | t | ) |
Set an expiration time relativelty to the current point with an offset t
If the function is called during the wait operation the behavior is undefined
ptime booster::aio::deadline_timer::expires_from_now | ( | ) |
Get an expiration time relativelty to the current point with an offset t
io_service& booster::aio::deadline_timer::get_io_service | ( | ) |
Returns the connected io_service, throws system::system_error if no io_service connected
void booster::aio::deadline_timer::reset_io_service | ( | ) |
Unsets the io_service. Cancels all pending asynchronous operations on the connected io_service.
void booster::aio::deadline_timer::set_io_service | ( | io_service & | srv | ) |
Sets new io_service. Cancels all pending asynchronous operations on the connected io_service.
void booster::aio::deadline_timer::wait | ( | ) |
Wait synchronously for the timer