X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fthread.h;h=51ca0ef3395c2abe80d182a6cef056429d655e75;hb=a883560b42163f5ed0c83204469d17dd4f0134b6;hp=a115853211ba122ddb3628326339d43473474a0b;hpb=1013e3c216cdf8e0ecc0f3b1e8314989b5333818;p=libs%2Fcore.git diff --git a/source/thread.h b/source/thread.h index a115853..51ca0ef 100644 --- a/source/thread.h +++ b/source/thread.h @@ -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 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 &);