PATCH: Re: eh_globals.cc compilation errors with -threads under hpux 10.20

Loren James Rittle rittle@latour.rsch.comm.mot.com
Thu May 24 05:10:00 GMT 2001


In article < 200105232245.SAA21482@hiauly1.hia.nrc.ca >,
"John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:

> Here how thing stand.  Thoughts?  I know there are more testsuite errors
> than before under i686 linux and I don't know why.  On the otherhand,
> we weren't reaaly using the posix thread stuff.

>--- gthr-posix.h.orig	Fri May 18 21:34:11 2001
>+++ gthr-posix.h	Wed May 23 17:01:31 2001
[...]

OK, I agree it is needed to compile the file with C++.

>	* aclocal.m4 (GLIBCPP_ENABLE_THREADS): Use threads-dce.h with DCE
>	threads.

Be aware that acinclude.m4 is the primary file and that aclocal.m4 is
derived from it.  However, I will offer another direction to take this
part of the patch in which will require less per-port maintenance
going forward.
 
> --- /dev/null	Fri Jun 30 18:48:12 2000
> +++ config/threads-dce.h	Wed May 23 17:15:22 2001

Not needed under my direction since we will get gcc/gthr-dce.h when we
are suppose to.

[In multiple places:]
> +#include "tconfig.h"

I still don't think this is wise.  Perhaps it is OK when we build a
library, such as libsupc++, that is installed...  But since I want to
use gthr.h to compiler user code against STL headers, thus I know we
can't use that approach since tconfig.h is not an installed header.

@@ -95,19 +97,14 @@
   g = (__cxa_eh_globals *) __gthread_getspecific (globals_key);
   if (! g)
     {
-      static __gthread_once_t once = __GTHREAD_ONCE_INIT;
-
-      // Make sure use_thread_key got initialized.  Some systems have
-      // dummy thread routines in their libc that return a success.
-      if (__gthread_once (&once, eh_threads_initialize) != 0
-	  || use_thread_key < 0)
+      // Make sure use_thread_key got initialized.
+      if (use_thread_key < 0)
 	{
 	  use_thread_key = 0;
 	  return &globals_static;
 	}
       
-      if ((g = malloc (sizeof (__cxa_eh_globals))) == 0
-	  || __gthread_setspecific (eh_context_key, (void *) g) != 0)
+      if ((g = (__cxa_eh_globals *) malloc (sizeof (__cxa_eh_globals))) == 0)
         std::terminate ();
       g->caughtExceptions = 0;
       g->uncaughtExceptions = 0;

This is too aggressive.  I think the call to __gthread_setspecific is,
um, very important. ;-)

My patch (which took pieces of yours) in next e-mail.

Regards,
Loren



More information about the Libstdc++ mailing list