From 3215deb2c5bd855a2b44fa2da90282dcea5a49ce Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 14 Jun 2017 03:55:23 -0400 Subject: [PATCH] make io_service::work accounting more accurate in asio-debugging=on --- include/libtorrent/disk_io_thread.hpp | 3 +++ src/disk_io_thread.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index 0c89a5907..7cc78e209 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_DISK_IO_THREAD #include "libtorrent/config.hpp" +#include "libtorrent/debug.hpp" #include "libtorrent/storage.hpp" #include "libtorrent/allocator.hpp" #include "libtorrent/io_service.hpp" @@ -398,12 +399,14 @@ namespace aux { void thread_fun(disk_io_thread_pool& pool, io_service::work work) override { + ADD_OUTSTANDING_ASYNC("disk_io_thread::work"); m_owner.thread_fun(*this, pool); // w's dtor releases the io_service to allow the run() call to return // we do this once we stop posting new callbacks to it. // after the dtor has been called, the disk_io_thread object may be destructed TORRENT_UNUSED(work); + COMPLETE_ASYNC("disk_io_thread::work"); } disk_io_thread& m_owner; diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 67b77ca49..45cf22221 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -198,7 +198,6 @@ namespace libtorrent { , m_stats_counters(cnt) , m_ios(ios) { - ADD_OUTSTANDING_ASYNC("disk_io_thread::work"); m_disk_cache.set_settings(m_settings); } @@ -3174,8 +3173,6 @@ namespace libtorrent { abort_jobs(); TORRENT_ASSERT(m_magic == 0x1337); - - COMPLETE_ASYNC("disk_io_thread::work"); } void disk_io_thread::abort_jobs()