diff options
author | John David Anglin <dave@hiauly1.hia.nrc.ca> | 2001-08-03 22:13:22 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2001-08-03 22:13:22 +0000 |
commit | 5241c227325d247ee6aed67e3a056b1f1d16149f (patch) | |
tree | 65da7a56e6ee8f546a8176fc1928dbd11ecc6ec1 /gcc | |
parent | cbec65739c1937dafec8f879cfaa7e891bdfef9a (diff) | |
download | gcc-5241c227325d247ee6aed67e3a056b1f1d16149f.zip gcc-5241c227325d247ee6aed67e3a056b1f1d16149f.tar.gz gcc-5241c227325d247ee6aed67e3a056b1f1d16149f.tar.bz2 |
gthr-dce.h (__GTHREAD_MUTEX_INIT_FUNCTION and __GTHREAD_MUTEX_INIT_DEFAULT): New macros for mutex initialization.
* gthr-dce.h (__GTHREAD_MUTEX_INIT_FUNCTION and
__GTHREAD_MUTEX_INIT_DEFAULT): New macros for mutex initialization.
(__gthread_key_delete): Remove code for __PTHREAD_LIBRARY_VERSION_1 >= 1
(__gthread_mutex_init_function): New function for mutex initialization.
From-SVN: r44614
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gthr-dce.h | 23 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1012827..06a0e96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-08-03 John David Anglin <dave@hiauly1.hia.nrc.ca> + + * gthr-dce.h (__GTHREAD_MUTEX_INIT_FUNCTION and + __GTHREAD_MUTEX_INIT_DEFAULT): New macros for mutex initialization. + (__gthread_key_delete): Remove code for __PTHREAD_LIBRARY_VERSION_1 >= 1 + (__gthread_mutex_init_function): New function for mutex initialization. + 2001-08-03 Daniel Berlin <dan@cgsoftware.com> * Makefile.in: Revert screwed up commit. diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h index 96660a3..916aefd 100644 --- a/gcc/gthr-dce.h +++ b/gcc/gthr-dce.h @@ -48,7 +48,10 @@ typedef pthread_once_t __gthread_once_t; typedef pthread_mutex_t __gthread_mutex_t; #define __GTHREAD_ONCE_INIT pthread_once_init -/* Howto define __GTHREAD_MUTEX_INIT? */ + +#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function + +#define __GTHREAD_MUTEX_INIT_DEFAULT pthread_once_init #if SUPPORTS_WEAK && GTHREAD_USE_WEAK @@ -59,7 +62,7 @@ typedef pthread_mutex_t __gthread_mutex_t; #pragma weak pthread_getspecific #pragma weak pthread_setspecific #pragma weak pthread_create - +#pragma weak pthread_mutex_init #pragma weak pthread_mutex_lock #pragma weak pthread_mutex_trylock #pragma weak pthread_mutex_unlock @@ -73,7 +76,6 @@ typedef pthread_mutex_t __gthread_mutex_t; #pragma weak pthread_cond_wait #pragma weak pthread_exit #pragma weak pthread_getunique_np -#pragma weak pthread_mutex_init #pragma weak pthread_mutex_destroy #pragma weak pthread_self #pragma weak pthread_yield @@ -424,20 +426,12 @@ __gthread_key_dtor (UNUSED (__gthread_key_t key), UNUSED (void *ptr)) return 0; } -#if defined (__PTHREAD_LIBRARY_VERSION_1) && __PTHREAD_LIBRARY_VERSION_1 >= 1 -static inline int -__gthread_key_delete (__gthread_key_t key) -{ - return pthread_key_delete (key); -} -#else static inline int __gthread_key_delete (UNUSED (__gthread_key_t key)) { /* Operation is not supported. */ return -1; } -#endif static inline void * __gthread_getspecific (__gthread_key_t key) @@ -455,6 +449,13 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return pthread_setspecific (key, (void *) ptr); } +static inline void +__gthread_mutex_init_function (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + pthread_mutex_init (mutex, pthread_mutexattr_default); +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { |