aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/libsupc++/eh_globals.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_globals.cc')
-rw-r--r--libstdc++-v3/libsupc++/eh_globals.cc44
1 files changed, 12 insertions, 32 deletions
diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc
index 0f0dee58d45..3243e2ae414 100644
--- a/libstdc++-v3/libsupc++/eh_globals.cc
+++ b/libstdc++-v3/libsupc++/eh_globals.cc
@@ -41,41 +41,15 @@ using namespace __cxxabiv1;
static __cxa_eh_globals globals_static;
#if __GTHREADS
-static __gthread_key_t globals_key;
+/* APPLE LOCAL begin radar 3373515 */
static int use_thread_key = -1;
static void
-get_globals_dtor (void *ptr)
-{
- if (ptr)
- {
- __cxa_exception *exn, *next;
- exn = ((__cxa_eh_globals *) ptr)->caughtExceptions;
- while (exn)
- {
- next = exn->nextException;
- _Unwind_DeleteException (&exn->unwindHeader);
- exn = next;
- }
- std::free (ptr);
- }
-}
-
-static void
-get_globals_init ()
-{
- use_thread_key =
- (__gthread_key_create (&globals_key, get_globals_dtor) == 0);
-}
-
-static void
get_globals_init_once ()
{
- static __gthread_once_t once = __GTHREAD_ONCE_INIT;
- if (__gthread_once (&once, get_globals_init) != 0
- || use_thread_key < 0)
- use_thread_key = 0;
+ use_thread_key = 1;
}
+/* APPLE LOCAL end radar 3373515 */
#endif
extern "C" __cxa_eh_globals *
@@ -83,7 +57,9 @@ __cxxabiv1::__cxa_get_globals_fast () throw()
{
#if __GTHREADS
if (use_thread_key)
- return (__cxa_eh_globals *) __gthread_getspecific (globals_key);
+ /* APPLE LOCAL begin radar 3373515 */
+ return (__cxa_eh_globals *) _keymgr_get_per_thread_data (KEYMGR_EH_GLOBALS_KEY);
+ /* APPLE LOCAL end radar 3373515 */
else
return &globals_static;
#else
@@ -109,12 +85,16 @@ __cxxabiv1::__cxa_get_globals () throw()
return &globals_static;
}
- g = (__cxa_eh_globals *) __gthread_getspecific (globals_key);
+ /* APPLE LOCAL begin radar 3373515 */
+ g = (__cxa_eh_globals *) _keymgr_get_per_thread_data (KEYMGR_EH_GLOBALS_KEY);
+ /* APPLE LOCAL end radar 3373515 */
if (! g)
{
if ((g = (__cxa_eh_globals *)
std::malloc (sizeof (__cxa_eh_globals))) == 0
- || __gthread_setspecific (globals_key, (void *) g) != 0)
+ /* APPLE LOCAL begin radar 3373515 */
+ || KEYMGR_SET_PER_THREAD_DATA (KEYMGR_EH_GLOBALS_KEY, (void *) g) != 0)
+ /* APPLE LOCAL end radar 3373515 */
std::terminate ();
g->caughtExceptions = 0;
g->uncaughtExceptions = 0;