Update thread-private work count when epoll operations are not complete.
diff --git a/asio/include/asio/detail/impl/epoll_reactor.ipp b/asio/include/asio/detail/impl/epoll_reactor.ipp index a2ddae4..d72737b 100644 --- a/asio/include/asio/detail/impl/epoll_reactor.ipp +++ b/asio/include/asio/detail/impl/epoll_reactor.ipp
@@ -635,7 +635,7 @@ // 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(); } }
diff --git a/asio/include/asio/detail/impl/scheduler.ipp b/asio/include/asio/detail/impl/scheduler.ipp index 8145651..66c9009 100644 --- a/asio/include/asio/detail/impl/scheduler.ipp +++ b/asio/include/asio/detail/impl/scheduler.ipp
@@ -243,6 +243,12 @@ 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) {
diff --git a/asio/include/asio/detail/scheduler.hpp b/asio/include/asio/detail/scheduler.hpp index 0589a99..fa80494 100644 --- a/asio/include/asio/detail/scheduler.hpp +++ b/asio/include/asio/detail/scheduler.hpp
@@ -79,6 +79,10 @@ ++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() {