summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxxabi/src/cxa_default_handlers.cpp4
-rw-r--r--libcxxabi/src/cxa_handlers.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp
index 79ac00d0c17..403ed04429a 100644
--- a/libcxxabi/src/cxa_default_handlers.cpp
+++ b/libcxxabi/src/cxa_default_handlers.cpp
@@ -103,7 +103,7 @@ set_unexpected(unexpected_handler func) _NOEXCEPT
{
if (func == 0)
func = default_unexpected_handler;
- return __sync_lock_test_and_set(&__cxxabiapple::__cxa_unexpected_handler, func);
+ return __sync_swap(&__cxxabiapple::__cxa_unexpected_handler, func);
}
terminate_handler
@@ -111,7 +111,7 @@ set_terminate(terminate_handler func) _NOEXCEPT
{
if (func == 0)
func = default_terminate_handler;
- return __sync_lock_test_and_set(&__cxxabiapple::__cxa_terminate_handler, func);
+ return __sync_swap(&__cxxabiapple::__cxa_terminate_handler, func);
}
};
diff --git a/libcxxabi/src/cxa_handlers.cpp b/libcxxabi/src/cxa_handlers.cpp
index 1cfdfe7ae70..97f1347010e 100644
--- a/libcxxabi/src/cxa_handlers.cpp
+++ b/libcxxabi/src/cxa_handlers.cpp
@@ -28,7 +28,7 @@ namespace std
unexpected_handler
get_unexpected() _NOEXCEPT
{
- return __sync_fetch_and_add(&__cxxabiapple::__cxa_unexpected_handler, (unexpected_handler)0);
+ return __cxxabiapple::__cxa_unexpected_handler;
}
__attribute__((visibility("hidden"), noreturn))
@@ -50,7 +50,7 @@ unexpected()
terminate_handler
get_terminate() _NOEXCEPT
{
- return __sync_fetch_and_add(&__cxxabiapple::__cxa_terminate_handler, (terminate_handler)0);
+ return __cxxabiapple::__cxa_terminate_handler;
}
__attribute__((visibility("hidden"), noreturn))
@@ -101,13 +101,13 @@ terminate() _NOEXCEPT
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
- return __sync_lock_test_and_set(&__cxxabiapple::__cxa_new_handler, handler);
+ return __sync_swap(&__cxxabiapple::__cxa_new_handler, handler);
}
new_handler
get_new_handler() _NOEXCEPT
{
- return __sync_fetch_and_add(&__cxxabiapple::__cxa_new_handler, (new_handler)0);
+ return __cxxabiapple::__cxa_new_handler;
}
} // std
OpenPOWER on IntegriCloud