]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/thread.h
Refactor Thread class with pimpl to avoid exposing platform-specific parts
[libs/core.git] / source / core / thread.h
index 92923f31bbd5718eb8816aed1e28d9e8e72dadda..59e6e060ce4b77d2e0e69b45f245e6537ca3a70b 100644 (file)
@@ -8,8 +8,6 @@ Distributed under the LGPL
 #ifndef MSP_CORE_THREAD_H_
 #define MSP_CORE_THREAD_H_
 
-#include "types.h"
-
 namespace Msp {
 
 /**
@@ -22,33 +20,24 @@ is started.
 class Thread
 {
 private:
-       ThreadHandle thread_;
-       bool         launched_;
+       struct Private;
+
+       Private *priv_;
+       bool launched_;
 
 protected:
-       Thread(): launched_(false) { }
+       Thread();
+private:
+       Thread(const Thread &);
+       Thread &operator=(const Thread &);
 public:
        virtual ~Thread();
 
        void join();
-       void cancel();
        void kill();
 protected:
        void launch();
        virtual void main() = 0;
-       void check_cancel();
-
-private:
-       static
-#ifdef WIN32
-       DWORD WINAPI
-#else
-       void *
-#endif
-       main_(void *t) { (reinterpret_cast<Thread *>(t))->main(); return 0; }
-
-       Thread(const Thread &);
-       Thread &operator=(const Thread &);
 };
 
 } // namespace Msp