make io_service::work accounting more accurate in asio-debugging=on

This commit is contained in:
arvidn 2017-06-14 03:55:23 -04:00 committed by Arvid Norberg
parent 9a19ff344b
commit 3215deb2c5
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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()