back port check to not destruct session_impl from its own thread

This commit is contained in:
Arvid Norberg 2013-09-29 19:37:57 +00:00
parent a623c4c41c
commit 4ac3d286a5
2 changed files with 10 additions and 0 deletions

View File

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

View File

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