summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Threading.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 17:53:30 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 17:53:30 +0000
commit0b6eb591a4d6a7ce35d1a06ecf37637920715fce (patch)
tree4ca441c8c925d46885ce6282846f21b239553190 /llvm/lib/Support/Threading.cpp
parent994863768773ccdb76606b5fc4dabb6745f5da23 (diff)
downloadbcm5719-llvm-0b6eb591a4d6a7ce35d1a06ecf37637920715fce.tar.gz
bcm5719-llvm-0b6eb591a4d6a7ce35d1a06ecf37637920715fce.zip
[C++11] Replace LLVM atomics with std::atomic.
With C++11 we finally have a standardized way to specify atomic operations. Use them to replace the existing custom implemention. Sadly the translation is not entirely trivial as std::atomic allows more fine-grained control over the atomicity. I tried to preserve the old semantics as well as possible. Differential Revision: http://llvm-reviews.chandlerc.com/D2915 llvm-svn: 202730
Diffstat (limited to 'llvm/lib/Support/Threading.cpp')
-rw-r--r--llvm/lib/Support/Threading.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 9d7ac6c18de..15dd8a98052 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -13,8 +13,8 @@
#include "llvm/Support/Threading.h"
#include "llvm/Config/config.h"
-#include "llvm/Support/Atomic.h"
#include "llvm/Support/Mutex.h"
+#include <atomic>
#include <cassert>
using namespace llvm;
@@ -31,7 +31,7 @@ bool llvm::llvm_start_multithreaded() {
// We fence here to ensure that all initialization is complete BEFORE we
// return from llvm_start_multithreaded().
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
return true;
#else
return false;
@@ -44,7 +44,7 @@ void llvm::llvm_stop_multithreaded() {
// We fence here to insure that all threaded operations are complete BEFORE we
// return from llvm_stop_multithreaded().
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
multithreaded_mode = false;
delete global_lock;
OpenPOWER on IntegriCloud