summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}