Use an extra bool variable to indicate thread validity
[libs/core.git] / source / thread.cpp
1 /*
2 This file is part of libmspframework
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
5 */
6 #include <signal.h>
7 #include "thread.h"
8
9 namespace Msp {
10
11 void *Thread::join()
12 {
13         if(!valid_)
14                 return 0;
15
16         void *result;
17         pthread_join(thread_, &result);
18         valid_=false;
19         return result;
20 }
21
22 Thread::~Thread()
23 {
24         if(valid)
25                 kill(SIGKILL);
26 }
27
28 } // namespace Msp