summaryrefslogtreecommitdiff
path: root/src/cxa_handlers.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-10-03 20:03:47 +0000
committerReid Kleckner <reid@kleckner.net>2014-10-03 20:03:47 +0000
commit5660f752e7eebc1b2cfd62ed1c1c12da75efc727 (patch)
treea020ac68153c5d3652b05fbab5e8124c28f66641 /src/cxa_handlers.cpp
parent40213fe60eb4f05294192911b58ddab0b27a2efd (diff)
Use __atomic_exchange_n instead of Clang's __sync_swap
Also remove an extra extern "C" from a global variable redeclaration. This allows building libcxxabi with GCC on my system. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D5604 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@219012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_handlers.cpp')
-rw-r--r--src/cxa_handlers.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cxa_handlers.cpp b/src/cxa_handlers.cpp
index 674933b..01207ff 100644
--- a/src/cxa_handlers.cpp
+++ b/src/cxa_handlers.cpp
@@ -102,14 +102,14 @@ terminate() _NOEXCEPT
__terminate(get_terminate());
}
-extern "C" new_handler __cxa_new_handler = 0;
+new_handler __cxa_new_handler = 0;
// In the future these will become:
// std::atomic<std::new_handler> __cxa_new_handler(0);
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
- return __sync_swap(&__cxa_new_handler, handler);
+ return __atomic_exchange_n(&__cxa_new_handler, handler, __ATOMIC_ACQ_REL);
// Using of C++11 atomics this should be rewritten
// return __cxa_new_handler.exchange(handler, memory_order_acq_rel);
}