Update thread-private work count when epoll operations are not complete.

This commit is contained in:
Christopher Kohlhoff 2015-05-03 22:36:38 +10:00
parent 5ab5356e33
commit fcf901ecb3
3 changed files with 11 additions and 1 deletions

View File

@ -635,7 +635,7 @@ struct epoll_reactor::perform_io_cleanup_on_block_exit
// No user-initiated operations have completed, so we need to compensate
// for the work_finished() call that the scheduler will make once this
// operation returns.
reactor_->scheduler_.work_started();
reactor_->scheduler_.compensating_work_started();
}
}

View File

@ -243,6 +243,12 @@ void scheduler::restart()
stopped_ = false;
}
void scheduler::compensating_work_started()
{
thread_info_base* this_thread = thread_call_stack::contains(this);
++static_cast<thread_info*>(this_thread)->private_outstanding_work;
}
void scheduler::post_immediate_completion(
scheduler::operation* op, bool is_continuation)
{

View File

@ -79,6 +79,10 @@ public:
++outstanding_work_;
}
// Used to compensate for a forthcoming work_finished call. Must be called
// from within a scheduler-owned thread.
ASIO_DECL void compensating_work_started();
// Notify that some work has finished.
void work_finished()
{