fixes #234. properly shuts down the disk io thread

This commit is contained in:
Arvid Norberg
2007-12-24 08:15:10 +00:00
parent 44735a425f
commit e0d1951fac
4 changed files with 20 additions and 7 deletions

View File

@@ -62,12 +62,7 @@ namespace libtorrent
disk_io_thread::~disk_io_thread()
{
mutex_t::scoped_lock l(m_mutex);
m_abort = true;
m_signal.notify_all();
l.unlock();
m_disk_io_thread.join();
TORRENT_ASSERT(m_abort == true);
}
#ifndef NDEBUG
@@ -95,6 +90,16 @@ namespace libtorrent
#endif
void disk_io_thread::join()
{
mutex_t::scoped_lock l(m_mutex);
m_abort = true;
m_signal.notify_all();
l.unlock();
m_disk_io_thread.join();
}
// aborts read operations
void disk_io_thread::stop(boost::intrusive_ptr<piece_manager> s)
{