diff --git a/asio/include/asio/detail/task_demuxer_service.hpp b/asio/include/asio/detail/task_demuxer_service.hpp index 39f83222..0dc185a3 100644 --- a/asio/include/asio/detail/task_demuxer_service.hpp +++ b/asio/include/asio/detail/task_demuxer_service.hpp @@ -101,7 +101,6 @@ public: { // Prepare to execute the task. task_is_running_ = true; - task_.reset(); lock.unlock(); // Helper class to perform operations on block exit. @@ -127,6 +126,7 @@ public: } c(lock, task_is_running_); // Run the task. May throw an exception. + task_.reset(); task_.run(); } else