This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] C++11: Observers for the three 'handler functions'

On 5 April 2013 11:13, Jonathan Wakely wrote:
> This should fix the handlers for platforms without __atomic_exchange
> for pointers by using a mutex. I used the old __mutex type not
> std::mutex because it's available on more platforms and works for the
> 'single' thread model too.  I didn't try to optimise away the atomic
> ops for accessing the handlers because throwing exceptions and
> getting/setting these handlers should not be on the fast path of
> performance sensitive code.
>         PR libstdc++/56841
>         * libsupc++/ (rethrow_exception): Use get_unexpected() and
>         get_terminate() accessors.
>         * libsupc++/ (__cxa_throw): Likewise.
>         * libsupc++/ Use mutex when atomic builtins not
>         available.
>         * libsupc++/ Likewise.
> Tested x86_64-linux and hppa2.0-linux, committed to trunk.

I did think about adding a new accessor for internal use:

std::pair<unexpected_handler, terminate_handler> __get_handlers();

which could be used in and to avoid doing two
separate PIC calls to get_unexpected() and get_terminate(), and so
that platforms using a mutex would only lock it once.  We can
reconsider doing that later, it's only an optimisation not needed for

I think we could also remove the extern declarations of
__unexpected_handler and __terminate_handler and make them internal to, as I already did for __new_handler.  Although those
names were visible to users they should not be used, are not part of
the IA-64 ABI, and are not exported from the shared lib.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]