* 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
+7 -2
View File
@@ -59,12 +59,15 @@ public:
enum state_type {
STATE_UNKNOWN,
STATE_INITIALIZED,
STATE_ACTIVE
STATE_ACTIVE,
STATE_INACTIVE
};
ThreadBase();
virtual ~ThreadBase();
bool is_active() const { return m_state == STATE_ACTIVE; }
torrent::Poll* poll() { return m_pollManager->get_torrent_poll(); }
core::PollManager* poll_manager() { return m_pollManager; }
priority_queue& task_scheduler() { return m_taskScheduler; }
@@ -72,7 +75,7 @@ public:
virtual void init_thread() = 0;
void start_thread();
void stop_thread();
static void stop_thread(ThreadBase* thread);
// ATM, only interaction with a thread's allowed by other threads is
// through the queue_item call.
@@ -94,6 +97,8 @@ protected:
core::PollManager* m_pollManager;
rak::priority_queue_default m_taskScheduler;
rak::priority_item m_taskShutdown;
// Temporary hack to pass messages to a thread. This really needs to
// be cleaned up and/or integrated into the priority queue itself.
thread_queue_hack* m_threadQueue;