11 #ifndef ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP    12 #define ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP    14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)    16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)    33 #if defined(ASIO_WINDOWS_RUNTIME)    36 #endif // defined(ASIO_WINDOWS_RUNTIME)    43 template <
typename Time_Traits>
    67     scheduler_.init_task();
    68     scheduler_.add_timer_queue(timer_queue_);
    74     scheduler_.remove_timer_queue(timer_queue_);
    86     impl.might_have_pending_waits = 
false;
    99     if (!impl.might_have_pending_waits)
   107     std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data);
   108     impl.might_have_pending_waits = 
false;
   117     if (!impl.might_have_pending_waits)
   125     std::size_t count = scheduler_.cancel_timer(
   126         timer_queue_, impl.timer_data, 1);
   128       impl.might_have_pending_waits = 
false;
   143     std::size_t count = 
cancel(impl, ec);
   144     impl.expiry = expiry_time;
   152     return Time_Traits::subtract(
expires_at(impl), Time_Traits::now());
   160         Time_Traits::add(Time_Traits::now(), expiry_time), ec);
   166     time_type now = Time_Traits::now();
   168     while (Time_Traits::less_than(now, impl.expiry) && !ec)
   170       this->do_wait(Time_Traits::to_posix_duration(
   171             Time_Traits::subtract(impl.expiry, now)), ec);
   172       now = Time_Traits::now();
   177   template <
typename Handler>
   182     typename op::ptr p = { asio::detail::addressof(handler),
   184         sizeof(op), handler), 0 };
   185     p.p = 
new (p.v) op(handler);
   187     impl.might_have_pending_waits = 
true;
   191     scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p);
   199   template <
typename Duration>
   202 #if defined(ASIO_WINDOWS_RUNTIME)   203     std::this_thread::sleep_for(
   204         std::chrono::seconds(timeout.total_seconds())
   205         + std::chrono::microseconds(timeout.total_microseconds()));
   207 #else // defined(ASIO_WINDOWS_RUNTIME)   209     tv.tv_sec = timeout.total_seconds();
   210     tv.tv_usec = timeout.total_microseconds() % 1000000;
   212 #endif // defined(ASIO_WINDOWS_RUNTIME)   227 #endif // ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP 
class select_reactor timer_scheduler
std::size_t expires_at(implementation_type &impl, const time_type &expiry_time, asio::error_code &ec)
Provides core I/O functionality. 
timer_queue< Time_Traits >::per_timer_data timer_data
Time_Traits::time_type time_type
std::size_t expires_from_now(implementation_type &impl, const duration_type &expiry_time, asio::error_code &ec)
Service & use_service(io_service &ios)
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout, asio::error_code &ec)
std::size_t cancel_one(implementation_type &impl, asio::error_code &ec)
deadline_timer_service(asio::io_service &io_service)
void wait(implementation_type &impl, asio::error_code &ec)
duration_type expires_from_now(const implementation_type &impl) const 
void async_wait(implementation_type &impl, Handler &handler)
time_type expires_at(const implementation_type &impl) const 
Class to represent an error code value. 
#define ASIO_HANDLER_OPERATION(args)
void * allocate(std::size_t s, Handler &h)
void destroy(implementation_type &impl)
void construct(implementation_type &impl)
Time_Traits::duration_type duration_type
~deadline_timer_service()
#define ASIO_HANDLER_CREATION(args)
std::size_t cancel(implementation_type &impl, asio::error_code &ec)
bool might_have_pending_waits