diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-03-19 16:56:51 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-03-19 16:56:51 +0000 |
commit | e59dbd7b826b848edbc2497f119d72044ec2a3cf (patch) | |
tree | b1288ab3b260a8c7f739835134a755202cc80a00 /libcxxabi/src/cxa_default_handlers.cpp | |
parent | c58dc9fcd2bca6534613a0e30971a3e2acbe231b (diff) | |
download | bcm5719-llvm-e59dbd7b826b848edbc2497f119d72044ec2a3cf.tar.gz bcm5719-llvm-e59dbd7b826b848edbc2497f119d72044ec2a3cf.zip |
I would really like to write the handlers in terms of C++11 atomics. This would give us the best performance, portablity, and safety tradeoff. Unfortunately I can not yet do that. So I've put the desired code in comments, and reverted the handler getters to the slower but safer legacy atomic intrinsics.
llvm-svn: 153041
Diffstat (limited to 'libcxxabi/src/cxa_default_handlers.cpp')
-rw-r--r-- | libcxxabi/src/cxa_default_handlers.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp index 726f7eb0e0a..8c25b723498 100644 --- a/libcxxabi/src/cxa_default_handlers.cpp +++ b/libcxxabi/src/cxa_default_handlers.cpp @@ -94,6 +94,10 @@ static void default_unexpected_handler() std::terminate_handler __cxa_terminate_handler = default_terminate_handler; std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler; +// In the future these will become: +// std::atomic<std::terminate_handler> __cxa_terminate_handler(default_terminate_handler); +// std::atomic<std::unexpected_handler> __cxa_unexpected_handler(default_unexpected_handler); + namespace std { @@ -103,6 +107,8 @@ set_unexpected(unexpected_handler func) _NOEXCEPT if (func == 0) func = default_unexpected_handler; return __sync_swap(&__cxa_unexpected_handler, func); +// Using of C++11 atomics this should be rewritten +// return __cxa_unexpected_handler.exchange(func, memory_order_acq_rel); } terminate_handler @@ -111,6 +117,8 @@ set_terminate(terminate_handler func) _NOEXCEPT if (func == 0) func = default_terminate_handler; return __sync_swap(&__cxa_terminate_handler, func); +// Using of C++11 atomics this should be rewritten +// return __cxa_terminate_handler.exchange(func, memory_order_acq_rel); } -}; +} |