Commit 7628e178 by Loren J. Rittle Committed by Loren J. Rittle

eh_alloc.cc: Ensure that required macros are defined before including gthr.h.

	* libsupc++/eh_alloc.cc: Ensure that required macros are
	defined before including gthr.h.  Ensure that we get the
	version of gthr.h for which we know how to provide a
	configuration.
	* libsupc++/eh_globals.cc: Likewise.  And, bring the threading
	code path into line with the current EH model.  Use std, where
	appropriate.

Co-Authored-By: John David Anglin <dave@hiauly1.hia.nrc.ca>

From-SVN: r42999
parent 5e218033
2001-06-07 Loren J. Rittle <ljrittle@acm.org> 2001-06-07 Loren J. Rittle <ljrittle@acm.org>
John David Anglin <dave@hiauly1.hia.nrc.ca> John David Anglin <dave@hiauly1.hia.nrc.ca>
* libsupc++/eh_alloc.cc: Ensure that required macros are
defined before including gthr.h. Ensure that we get the
version of gthr.h for which we know how to provide a
configuration.
* libsupc++/eh_globals.cc: Likewise. And, bring the threading
code path into line with the current EH model. Use std, where
appropriate.
2001-06-07 Loren J. Rittle <ljrittle@acm.org>
John David Anglin <dave@hiauly1.hia.nrc.ca>
* config/threads-no.h: Remove file. * config/threads-no.h: Remove file.
* config/threads-posix.h: Remove file. * config/threads-posix.h: Remove file.
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
#include <cstring> #include <cstring>
#include <limits.h> #include <limits.h>
#include "unwind-cxx.h" #include "unwind-cxx.h"
#include "gthr.h" #include "bits/c++config.h"
#include "bits/gthr.h"
using namespace __cxxabiv1; using namespace __cxxabiv1;
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
#include <exception> #include <exception>
#include <cstdlib>
#include "unwind-cxx.h" #include "unwind-cxx.h"
#include "gthr.h" #include "bits/c++config.h"
#include "bits/gthr.h"
using namespace __cxxabiv1; using namespace __cxxabiv1;
...@@ -47,7 +49,7 @@ get_globals_dtor (void *ptr) ...@@ -47,7 +49,7 @@ get_globals_dtor (void *ptr)
{ {
__gthread_key_dtor (globals_key, ptr); __gthread_key_dtor (globals_key, ptr);
if (ptr) if (ptr)
free (ptr); std::free (ptr);
} }
static void static void
...@@ -90,24 +92,20 @@ __cxa_get_globals () ...@@ -90,24 +92,20 @@ __cxa_get_globals ()
return &globals_static; return &globals_static;
if (use_thread_key < 0) if (use_thread_key < 0)
get_globals_init_once ();
g = (__cxa_eh_globals *) __gthread_getspecific (globals_key);
if (! g)
{ {
static __gthread_once_t once = __GTHREAD_ONCE_INIT; get_globals_init_once ();
// Make sure use_thread_key got initialized. Some systems have // Make sure use_thread_key got initialized.
// dummy thread routines in their libc that return a success. if (use_thread_key == 0)
if (__gthread_once (&once, eh_threads_initialize) != 0
|| use_thread_key < 0)
{
use_thread_key = 0;
return &globals_static; return &globals_static;
} }
if ((g = malloc (sizeof (__cxa_eh_globals))) == 0 g = (__cxa_eh_globals *) __gthread_getspecific (globals_key);
|| __gthread_setspecific (eh_context_key, (void *) g) != 0) if (! g)
{
if ((g = (__cxa_eh_globals *)
std::malloc (sizeof (__cxa_eh_globals))) == 0
|| __gthread_setspecific (globals_key, (void *) g) != 0)
std::terminate (); std::terminate ();
g->caughtExceptions = 0; g->caughtExceptions = 0;
g->uncaughtExceptions = 0; g->uncaughtExceptions = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment