summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/Threads.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/includes/Threads.h b/includes/Threads.h
index bc2670d..f6aed5a 100644
--- a/includes/Threads.h
+++ b/includes/Threads.h
@@ -22,23 +22,30 @@ class Lock {
class ThreadHelper;
-class Thread : public AtExit {
+class Thread {
public:
virtual ~Thread();
void threadStart();
void * join();
protected:
- Thread(bool registerAtExit = false) : AtExit(registerAtExit ? 1 : -1), m_joined(false) { }
+ Thread() : m_joined(false) { }
virtual void * proc() = 0;
- virtual void threadExit();
+ virtual void threadExit() { };
private:
pthread_t m_thread;
volatile bool m_joined;
- virtual void doExit() { join(); }
friend class ThreadHelper;
};
+class GlobalThread : public Thread, public AtStart, public AtExit {
+ protected:
+ GlobalThread(int startOrder = 10) : AtStart(startOrder), AtExit(1) { }
+ private:
+ virtual void doStart() { threadStart(); }
+ virtual void doExit() { join(); }
+};
+
template<class T>
class Queue {
public: