mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202730 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user