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