diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index e471ea0cf..9696aec2c 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -271,6 +271,14 @@ namespace libtorrent #if defined BOOST_HAS_PTHREADS if (m_network_thread == 0) return true; return m_network_thread == pthread_self(); +#endif + return true; + } + bool is_not_network_thread() const + { +#if defined BOOST_HAS_PTHREADS + if (m_network_thread == 0) return true; + return m_network_thread != pthread_self(); #endif return true; } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 8be95bcc0..256511438 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -5940,6 +5940,8 @@ retry: session_impl::~session_impl() { + TORRENT_ASSERT(is_not_network_thread()); + m_io_service.post(boost::bind(&session_impl::abort, this)); // we need to wait for the disk-io thread to