]> git.tdb.fi Git - libs/core.git/blobdiff - source/thread.h
Win32 tweaks
[libs/core.git] / source / thread.h
index a115853211ba122ddb3628326339d43473474a0b..51ca0ef3395c2abe80d182a6cef056429d655e75 100644 (file)
@@ -6,6 +6,10 @@ Distributed under the LGPL
 #ifndef MSP_FRAMEWORK_THREAD_H_
 #define MSP_FRAMEWORK_THREAD_H_
 
+#ifdef WIN32
+#include "win32signum.h"
+#endif
+
 #include <pthread.h>
 
 namespace Msp {
@@ -17,12 +21,13 @@ public:
        void kill(int s)   { pthread_kill(thread_, s); }
        virtual ~Thread();
 protected:
-       Thread()           { }
-       void launch()      { pthread_create(&thread_, 0, &main_, this); }
+       Thread(): valid_(false) { }
+       void launch()      { if(!valid_) pthread_create(&thread_, 0, &main_, this); }
        virtual void *main()=0;
        void exit(void *r) { pthread_exit(r); }
 private:
        pthread_t thread_;
+       bool      valid_;
 
        Thread(const Thread &);
        Thread &operator=(const Thread &);