* 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
+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,
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;
}