Author: zarzycki
Date: Thu Mar 15 03:58:08 2012
New Revision: 152786

URL: http://llvm.org/viewvc/llvm-project?rev=152786&view=rev
Log:
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.

Modified:
    libcxxabi/trunk/src/cxa_default_handlers.cpp
    libcxxabi/trunk/src/cxa_handlers.cpp

Modified: libcxxabi/trunk/src/cxa_default_handlers.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_default_handlers.cpp?rev=152786&r1=152785&r2=152786&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_default_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_default_handlers.cpp Thu Mar 15 03:58:08 2012
@@ -103,7 +103,7 @@
 {
        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 @@
 {
        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);
 }
 
 };

Modified: libcxxabi/trunk/src/cxa_handlers.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_handlers.cpp?rev=152786&r1=152785&r2=152786&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_handlers.cpp Thu Mar 15 03:58:08 2012
@@ -28,7 +28,7 @@
 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 @@
 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 @@
 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


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to