* Added shutdown for worker thread.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1117 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-12-22 03:29:47 +00:00
parent 5a1d0be323
commit 2c7563825c
5 changed files with 54 additions and 12 deletions
+13
View File
@@ -144,9 +144,18 @@ Control::cleanup_exception() {
display::Canvas::cleanup();
}
bool
Control::is_shutdown_completed() {
return m_shutdownQuick && !worker_thread->is_active() && torrent::is_inactive();
}
void
Control::handle_shutdown() {
if (!m_shutdownQuick) {
// Temporary hack:
if (worker_thread->is_active())
worker_thread->queue_item(&ThreadBase::stop_thread);
torrent::connection_manager()->listen_close();
m_core->shutdown(false);
@@ -154,6 +163,10 @@ Control::handle_shutdown() {
priority_queue_insert(&taskScheduler, &m_taskShutdown, cachedTime + rak::timer::from_seconds(5));
} else {
// Temporary hack:
if (worker_thread->is_active())
worker_thread->queue_item(&ThreadBase::stop_thread);
m_core->shutdown(true);
}