summaryrefslogtreecommitdiffstats
path: root/libcxx/src/new.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-12-02 16:45:21 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-12-02 16:45:21 +0000
commit1596c4531b3950f4c883013cb51182ad40884633 (patch)
tree969833db70ead1f9cf8f6d0ec88590ab60858fbe /libcxx/src/new.cpp
parentcdae9242fa11b0bb9a575dc4632fc3008c662339 (diff)
downloadbcm5719-llvm-1596c4531b3950f4c883013cb51182ad40884633.tar.gz
bcm5719-llvm-1596c4531b3950f4c883013cb51182ad40884633.zip
N3189 Observers for the three handler functions
llvm-svn: 120712
Diffstat (limited to 'libcxx/src/new.cpp')
-rw-r--r--libcxx/src/new.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 874ad6c0230..a3783d47efa 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -130,9 +130,13 @@ const nothrow_t nothrow = {};
new_handler
set_new_handler(new_handler handler) throw()
{
- new_handler r = __new_handler;
- __new_handler = handler;
- return r;
+ return __sync_lock_test_and_set(&__new_handler, handler);
+}
+
+new_handler
+get_new_handler() throw()
+{
+ return __sync_fetch_and_add(&__new_handler, (new_handler)0);
}
bad_alloc::bad_alloc() throw()
OpenPOWER on IntegriCloud