back port check to not destruct session_impl from its own thread
This commit is contained in:
@@ -271,6 +271,14 @@ namespace libtorrent
|
|||||||
#if defined BOOST_HAS_PTHREADS
|
#if defined BOOST_HAS_PTHREADS
|
||||||
if (m_network_thread == 0) return true;
|
if (m_network_thread == 0) return true;
|
||||||
return m_network_thread == pthread_self();
|
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
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -5940,6 +5940,8 @@ retry:
|
|||||||
|
|
||||||
session_impl::~session_impl()
|
session_impl::~session_impl()
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(is_not_network_thread());
|
||||||
|
|
||||||
m_io_service.post(boost::bind(&session_impl::abort, this));
|
m_io_service.post(boost::bind(&session_impl::abort, this));
|
||||||
|
|
||||||
// we need to wait for the disk-io thread to
|
// we need to wait for the disk-io thread to
|
||||||
|
Reference in New Issue
Block a user