summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-09 19:21:10 +0100
committerPixel <pixel@nobis-crew.org>2011-11-09 19:21:10 +0100
commit6a0edd7cce28d9a62350e4db39e1b2d1ce27ae4b (patch)
tree69a114366028db39fdca31d7c3a35481c188db43 /src
parent934956b50f91ab11486001661e1a4a8c2126f788 (diff)
Securing a bit more the thread-joining.
Diffstat (limited to 'src')
-rw-r--r--src/Threads.cc5
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;
}