void post_immediate_completion(operation* op) { if (one_thread_) { if (task_io_service_thread_info* this_thread = thread_call_stack::contains(this)) { ++this_thread->private_outstanding_work; this_thread->private_op_que.push_back(op); return ; } } work_started(); scoped_lock lock(mutex_); //std::cout << __func__ << " -- op_que_ push op" << std::endl; //std::cout << "op: " << op << std::endl; op_que_.push_back(op); //std::cout << __func__ << " -- op_que_.size: " << op_que_.size() << std::endl; wake_one_thread_and_unlock(lock); }
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(); }