diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-03 00:08:54 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-03 00:08:54 +0000 |
commit | a366a1d39800dd1c8d89eaf8b1247866b90b59f1 (patch) | |
tree | 41b23a61903b4ffa760fefd1e9f216e33e089932 /libstdc++-v3/libsupc++/eh_terminate.cc | |
parent | 3ca21885bf62d811e364fc478a44da09652a3bc7 (diff) | |
download | gcc-a366a1d39800dd1c8d89eaf8b1247866b90b59f1.tar.gz |
* libsupc++/exception (get_terminate(), get_unexpected()): Declare.
* libsupc++/eh_terminate.cc (get_terminate() , set_unexpected()):
Define.
(set_terminate(terminate_handler)): Set atomically.
(set_unexpected(terminate_handler)): Likewise.
* libsupc++/new (get_new_handler()): Declare.
* libsupc++/new_handler.cc (get_new_handler()): Define.
(set_new_handler(new_handler)): Set atomically.
(__new_handler): Use internal linkage.
* libsupc++/new_op.cc (operator new): Use get_new_handler().
* libsupc++/new_opnt.cc (operator new): Likewise.
* acinclude.m4: Bump libtool_VERSION to 6:19:0.
* configure: Regenerate.
* libsupc++/Makefile.am: Compile above files with -std=gnu++11.
* libsupc++/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add new exports.
* doc/xml/manual/status_cxx2011.xml: Update.
* testsuite/18_support/headers/exception/synopsis.cc: Check accessors
for handlers.
* testsuite/18_support/headers/new/synopsis.cc: Likewise.
* testsuite/18_support/new_handler.cc: New.
* testsuite/18_support/terminate_handler.cc: New.
* testsuite/18_support/unexpected_handler.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_terminate.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/eh_terminate.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libstdc++-v3/libsupc++/eh_terminate.cc b/libstdc++-v3/libsupc++/eh_terminate.cc index b54c8598401..bc38e1d201d 100644 --- a/libstdc++-v3/libsupc++/eh_terminate.cc +++ b/libstdc++-v3/libsupc++/eh_terminate.cc @@ -45,7 +45,7 @@ __cxxabiv1::__terminate (std::terminate_handler handler) throw () void std::terminate () throw() { - __terminate (__terminate_handler); + __terminate (get_terminate ()); } void @@ -58,21 +58,37 @@ __cxxabiv1::__unexpected (std::unexpected_handler handler) void std::unexpected () { - __unexpected (__unexpected_handler); + __unexpected (get_unexpected ()); } std::terminate_handler std::set_terminate (std::terminate_handler func) throw() { - std::terminate_handler old = __terminate_handler; - __terminate_handler = func; + std::terminate_handler old; + __atomic_exchange (&__terminate_handler, &func, &old, __ATOMIC_ACQ_REL); return old; } +std::terminate_handler +std::get_terminate () noexcept +{ + std::terminate_handler func; + __atomic_load (&__terminate_handler, &func, __ATOMIC_ACQUIRE); + return func; +} + std::unexpected_handler std::set_unexpected (std::unexpected_handler func) throw() { - std::unexpected_handler old = __unexpected_handler; - __unexpected_handler = func; + std::unexpected_handler old; + __atomic_exchange (&__unexpected_handler, &func, &old, __ATOMIC_ACQ_REL); return old; } + +std::unexpected_handler +std::get_unexpected () noexcept +{ + std::unexpected_handler func; + __atomic_load (&__unexpected_handler, &func, __ATOMIC_ACQUIRE); + return func; +} |