Moved code from ThreadBase to torrent::thread_base.

This commit is contained in:
Jari Sundell
2011-12-19 03:20:42 +09:00
parent 5b7a2b5e95
commit 007d83e904
2 changed files with 17 additions and 46 deletions
+3 -7
View File
@@ -54,16 +54,13 @@ class ThreadBase : public torrent::thread_base {
public:
typedef rak::priority_queue_default priority_queue;
typedef void (*thread_base_func)(ThreadBase*);
typedef void* (*pthread_func)(void*);
ThreadBase();
virtual ~ThreadBase();
priority_queue& task_scheduler() { return m_taskScheduler; }
virtual void init_thread() = 0;
void start_thread();
// Throw torrent::shutdown_exception to stop the thread.
static void stop_thread(ThreadBase* thread);
// ATM, only interaction with a thread's allowed by other threads is
@@ -71,8 +68,6 @@ public:
void queue_item(thread_base_func newFunc);
static void* event_loop(ThreadBase* thread);
// Only call this when global lock has been acquired, as it checks
// ThreadBase::is_main_polling() which is only guaranteed to remain
// 'false' if global lock keeps main thread from entering polling
@@ -82,9 +77,10 @@ public:
static void interrupt_main_polling();
protected:
inline rak::timer client_next_timeout();
int64_t next_timeout_usec();
void call_queued_items();
virtual void call_events();
// TODO: Add thread name.