diff options
author | ovidiu <ovidiu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-02 05:20:37 +0000 |
---|---|---|
committer | ovidiu <ovidiu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-02 05:20:37 +0000 |
commit | 9cdfb95df0b47fc1c5a9c826a4e748701fba05c9 (patch) | |
tree | 40c516bc50c67f4363d4a013af86fecbf6aca391 /gcc/gthr-dce.h | |
parent | 0abf894c1fcf45f2a726011624d0a18b878ad214 (diff) | |
download | gcc-9cdfb95df0b47fc1c5a9c826a4e748701fba05c9.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36112 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-dce.h')
-rw-r--r-- | gcc/gthr-dce.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h index 199dfe66b40..c2c24cdfe31 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; } |