]> gcc.gnu.org Git - gcc.git/commitdiff
Patch from Teemu Torma to fix Solaris 2.6 EH failures.
authorTeemu Torma <tot@trema.com>
Wed, 11 Mar 1998 12:07:25 +0000 (12:07 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 11 Mar 1998 12:07:25 +0000 (04:07 -0800)
* gthr.h: Changed the comment about return values.
* gthr-solaris.h (__gthread_once): Do not use errno; return the
error number instead of -1.
(__gthread_key_create): Any non-zero return value is an error.
* libgcc2.c (eh_context_initialize): Check for non-zero return
value from __gthread_once.
Check that the value of get_eh_context was really changed.

From-SVN: r18480

gcc/ChangeLog
gcc/gthr-solaris.h
gcc/gthr.h
gcc/libgcc2.c

index 6e9438d8a7d4e073b6fc8b383fc31a0ffa41b749..cb234fce105f06370cf25feee66aae2525295874 100644 (file)
@@ -1,3 +1,13 @@
+Wed Mar 11 12:05:20 1998  Teemu Torma  <tot@trema.com>
+
+       * gthr.h: Changed the comment about return values.
+       * gthr-solaris.h (__gthread_once): Do not use errno; return the
+       error number instead of -1. 
+       (__gthread_key_create): Any non-zero return value is an error.
+       * libgcc2.c (eh_context_initialize): Check for non-zero return
+       value from __gthread_once.
+       Check that the value of get_eh_context was really changed.
+
 Wed Mar 11 18:26:25 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * sh.h (LOOP_ALIGN): Only align when optimizing.
index 465ececb13947c4ce90bccec62ea4853d133864b..a6f669c2e096bf0c66de3c0302fd979fb856b0f6 100644 (file)
@@ -88,15 +88,13 @@ __gthread_once (__gthread_once_t *once, void (*func) ())
     return -1;
 
   if (once == 0 || func == 0)
-    {
-      errno = EINVAL;
-      return -1;
-    }
+    return EINVAL;
 
   if (once->once == 0)
     {
-      if (mutex_lock (&once->mutex) != 0)
-       return -1;
+      int status = mutex_lock (&once->mutex);
+      if (status != 0)
+       return status;
       if (once->once == 0)
        {
          (*func) ();
@@ -113,7 +111,7 @@ __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
   /* Solaris 2.5 contains thr_* routines no-op in libc, so test if we actually
      got a reasonable key value, and if not, fail. */
   *key = -1;
-  if (thr_keycreate (key, dtor) == -1 || *key == -1)
+  if (thr_keycreate (key, dtor) != 0 || *key == -1)
     return -1;
   else
     return 0;
index 54ad6b04c8dab4e1a6982d7a53eb435eb63f8819..9c5365426bfd287f1ff95107a88e2c100ed4266d 100644 (file)
@@ -65,7 +65,8 @@ Boston, MA 02111-1307, USA.  */
      int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
      int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
 
-   All functions returning int should return 0 on success, -1 on error.
+   All functions returning int should return zero on success or the error
+   number.  If the operation is not supported, -1 is returned.
 
    Currently supported threads packages are
      POSIX threads with -D_PTHREADS
index e5ad42089e46ee6b6caea91521760040e3cd40b9..f1032a582391a2a76a3d5cba888b0399ebc13a5f 100644 (file)
@@ -3132,7 +3132,11 @@ eh_context_initialize ()
 #if __GTHREADS
 
   static __gthread_once_t once = __GTHREAD_ONCE_INIT;
-  if (__gthread_once (&once, eh_threads_initialize) == -1)
+  /* Make sure that get_eh_context does not point to us anymore.
+     Some systems have dummy thread routines in their libc that
+     return a success (Solaris 2.6 for example). */
+  if (__gthread_once (&once, eh_threads_initialize) != 0
+      || get_eh_context == &eh_context_initialize)
     {
       /* Use static version of EH context. */
       get_eh_context = &eh_context_static;
This page took 0.071056 seconds and 5 git commands to generate.