本文整理汇总了C++中timer_queue::enqueue_timer方法的典型用法代码示例。如果您正苦于以下问题:C++ timer_queue::enqueue_timer方法的具体用法?C++ timer_queue::enqueue_timer怎么用?C++ timer_queue::enqueue_timer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer_queue
的用法示例。
在下文中一共展示了timer_queue::enqueue_timer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: schedule_timer
void epoll_reactor::schedule_timer(timer_queue<Time_Traits>& queue,
const typename Time_Traits::time_type& time,
typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
{
mutex::scoped_lock lock(mutex_);
if (shutdown_)
{
io_service_.post_immediate_completion(op, false);
return;
}
bool earliest = queue.enqueue_timer(time, timer, op);
io_service_.work_started();
if (earliest)
update_timeout();
}
示例2: schedule_timer
void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue,
const typename Time_Traits::time_type& time,
typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op)
{
boost::asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
{
io_service_.post_immediate_completion(op);
return;
}
bool earliest = queue.enqueue_timer(time, timer, op);
io_service_.work_started();
if (earliest)
interrupter_.interrupt();
}
示例3: schedule_timer
void winrt_timer_scheduler::schedule_timer(timer_queue<Time_Traits>& queue,
const typename Time_Traits::time_type& time,
typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
{
boost::asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
{
io_service_.post_immediate_completion(op, false);
return;
}
bool earliest = queue.enqueue_timer(time, timer, op);
io_service_.work_started();
if (earliest)
event_.signal(lock);
}
示例4: schedule_timer
void win_iocp_io_service::schedule_timer(timer_queue<Time_Traits>& queue,
const typename Time_Traits::time_type& time,
typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
{
// If the service has been shut down we silently discard the timer.
if (::InterlockedExchangeAdd(&shutdown_, 0) != 0)
{
post_immediate_completion(op, false);
return;
}
mutex::scoped_lock lock(dispatch_mutex_);
bool earliest = queue.enqueue_timer(time, timer, op);
work_started();
if (earliest)
update_timeout();
}