summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-12-18 18:10:39 -0800
committerNicolas Noble <pixel@nobis-crew.org>2013-12-18 18:10:39 -0800
commitd489bcc2cba7c454874ae09e2e1df5d9dc6958aa (patch)
treedcf09d48f609fd7a7834e311663a3885b17459bf /src
parent9e2b2679cb94ba4950aa98323e4c61a3e53546e2 (diff)
Removing Atomic.h and all volatiles.
Diffstat (limited to 'src')
-rw-r--r--src/Async.cc4
-rw-r--r--src/Selectable.cc1
-rw-r--r--src/Socket.cc1
-rw-r--r--src/Threads.cc4
4 files changed, 4 insertions, 6 deletions
diff --git a/src/Async.cc b/src/Async.cc
index 09465d3..a638451 100644
--- a/src/Async.cc
+++ b/src/Async.cc
@@ -103,7 +103,7 @@ void * Balau::AsyncManager::proc() {
stopAllWorkers();
Printer::elog(E_ASYNC, "Async thread waits for all idle queues to empty");
- while (Atomic::Prefetch::Decrement(&m_numTLSes)) {
+ while (m_numTLSes--) {
TLS * tls = m_TLSes.pop();
while (!tls->idleQueue.isEmpty());
}
@@ -166,7 +166,7 @@ void Balau::AsyncManager::idle() {
void Balau::AsyncManager::threadExit() {
Printer::elog(E_ASYNC, "AsyncManager thread is being asked to stop; creating stopper");
- if (Atomic::CmpXChgBool(&m_stopperPushed, true, false))
+ if (!m_stopperPushed.exchange(true))
m_queue.push(new AsyncStopper());
}
diff --git a/src/Selectable.cc b/src/Selectable.cc
index f716bb1..6bef2bc 100644
--- a/src/Selectable.cc
+++ b/src/Selectable.cc
@@ -8,7 +8,6 @@
#include "Threads.h"
#include "Printer.h"
#include "Main.h"
-#include "Atomic.h"
#include "Async.h"
#include "Task.h"
#include "TaskMan.h"
diff --git a/src/Socket.cc b/src/Socket.cc
index b22539f..2247d77 100644
--- a/src/Socket.cc
+++ b/src/Socket.cc
@@ -12,7 +12,6 @@
#include "Threads.h"
#include "Printer.h"
#include "Main.h"
-#include "Atomic.h"
#include "Async.h"
#include "Task.h"
#include "TaskMan.h"
diff --git a/src/Threads.cc b/src/Threads.cc
index 6de9186..c05d23f 100644
--- a/src/Threads.cc
+++ b/src/Threads.cc
@@ -1,7 +1,7 @@
+#include <atomic>
#include "Exceptions.h"
#include "Threads.h"
#include "Local.h"
-#include "Atomic.h"
#include "TaskMan.h"
namespace Balau {
@@ -90,7 +90,7 @@ Balau::Thread::~Thread() {
void * Balau::Thread::join() {
void * r = NULL;
- if (Atomic::CmpXChgBool(&m_joined, true, false)) {
+ if (!m_joined.exchange(true)) {
threadExit();
pthread_join(m_thread, &r);
}