aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. David Anglin <dave@hiauly1.hia.nrc.ca>2000-09-02 05:20:37 +0000
committerOvidiu Predescu <ovidiu@gcc.gnu.org>2000-09-02 05:20:37 +0000
commit802a8181851e4848f740686e8f10ca4b7aa4e39a (patch)
tree40c516bc50c67f4363d4a013af86fecbf6aca391
parent1a66cd67e2eb4391e2b71f032aaf036efe5a728d (diff)
downloadgcc-802a8181851e4848f740686e8f10ca4b7aa4e39a.zip
gcc-802a8181851e4848f740686e8f10ca4b7aa4e39a.tar.gz
gcc-802a8181851e4848f740686e8f10ca4b7aa4e39a.tar.bz2
gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t object before calling pthread_mutex_init.
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
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gthr-dce.h14
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 03a624c..5d9a80a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h
index 199dfe6..c2c24cd 100644
--- a/gcc/gthr-dce.h
+++ b/gcc/gthr-dce.h
@@ -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;
}