summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Zarzycki <zarzycki@apple.com>2012-03-15 08:58:08 +0000
committerDave Zarzycki <zarzycki@apple.com>2012-03-15 08:58:08 +0000
commitd6533ccd48957d81a13399a48cf01f88e4840bb0 (patch)
treeb4c4034e74f3aa37263f6599594c888da0e265a4
parent13e35c086cc5988a8b5ab26f1ddfe9278783ae12 (diff)
downloadbcm5719-llvm-d6533ccd48957d81a13399a48cf01f88e4840bb0.tar.gz
bcm5719-llvm-d6533ccd48957d81a13399a48cf01f88e4840bb0.zip
Less lame "concurrency" support
These APIs aren't thread safe, but they're pretending to be. Let's at least make the getter as fast as they can be. The setters are a lost cause unless the API can be fixed. llvm-svn: 152786
-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