diff options
author | Pixel <pixel@nobis-crew.org> | 2011-11-09 19:21:10 +0100 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-11-09 19:21:10 +0100 |
commit | 6a0edd7cce28d9a62350e4db39e1b2d1ce27ae4b (patch) | |
tree | 69a114366028db39fdca31d7c3a35481c188db43 | |
parent | 934956b50f91ab11486001661e1a4a8c2126f788 (diff) |
Securing a bit more the thread-joining.
-rw-r--r-- | src/Threads.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Threads.cc b/src/Threads.cc index 5f07040..f6578ed 100644 --- a/src/Threads.cc +++ b/src/Threads.cc @@ -1,6 +1,7 @@ #include "Exceptions.h" #include "Threads.h" #include "Local.h" +#include "Atomic.h" namespace Balau { @@ -38,10 +39,8 @@ Balau::Thread::~Thread() { void * Balau::Thread::join() { void * r = NULL; - if (!m_joined) { - m_joined = true; + if (Atomic::CmpXChgBool(&m_joined, true, false)) pthread_join(m_thread, &r); - } return r; } |