]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t object before...
authorJ. David Anglin <dave@hiauly1.hia.nrc.ca>
Sat, 2 Sep 2000 05:20:37 +0000 (05:20 +0000)
committerOvidiu Predescu <ovidiu@gcc.gnu.org>
Sat, 2 Sep 2000 05:20:37 +0000 (05:20 +0000)
2000-08-31  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

* gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t
object before calling pthread_mutex_init.

From-SVN: r36112

gcc/ChangeLog
gcc/gthr-dce.h

index 03a624c8f5961ae0f480afa28a758c26cad89c5d..5d9a80a922c6b135874e15d542124e417455fed5 100644 (file)
@@ -1,3 +1,8 @@
+2000-08-31  J. David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t
+       object before calling pthread_mutex_init.
+
 2000-09-02  Alexandre Oliva  <aoliva@redhat.com>
 
        * config/sh/t-elf, config/sh/crt1.asm, config/sh/crti.asm,
index 199dfe66b409af6f1fc5b2fb90c699ba178b8402..c2c24cdfe3114d460cbe9cdaea3af5d6674e27cf 100644 (file)
@@ -274,10 +274,18 @@ __gthread_objc_thread_get_data(void)
 static inline int
 __gthread_objc_mutex_allocate(objc_mutex_t mutex)
 {
-  if (__gthread_active_p ()
-      && pthread_mutex_init((pthread_mutex_t *)mutex->backend,
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc(sizeof(pthread_mutex_t));
+
+      if (pthread_mutex_init((pthread_mutex_t *)mutex->backend,
                            pthread_mutexattr_default))
-    return -1;
+        {
+          objc_free(mutex->backend);
+          mutex->backend = NULL;
+          return -1;
+        }
+    }
 
   return 0;
 }