diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-09-10 18:43:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-09-10 18:43:37 +0000 |
commit | 6fb7c68eb50c17d4283fd6a3fcc06ed6ddaeb1c7 (patch) | |
tree | 7cd3bb42805d3536750b127721b37a6d3ede6092 /malloc | |
parent | 2119c7059e593c336a916ca542583b0da7222960 (diff) | |
download | glibc-6fb7c68eb50c17d4283fd6a3fcc06ed6ddaeb1c7.zip glibc-6fb7c68eb50c17d4283fd6a3fcc06ed6ddaeb1c7.tar.gz glibc-6fb7c68eb50c17d4283fd6a3fcc06ed6ddaeb1c7.tar.bz2 |
Update.
2000-09-05 Wolfram Gloger <wg@malloc.de>
* malloc/thread-m.h [_LIBC]: Even if not linking with libpthread,
ensure usability of mutex as an `in use' flag.
Diffstat (limited to 'malloc')
-rw-r--r-- | malloc/thread-m.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/malloc/thread-m.h b/malloc/thread-m.h index d5b1e2f..4e51bc2 100644 --- a/malloc/thread-m.h +++ b/malloc/thread-m.h @@ -1,6 +1,6 @@ /* Basic platform-independent macro definitions for mutexes and thread-specific data. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996. @@ -42,14 +42,22 @@ typedef pthread_mutex_t mutex_t; #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +/* Even if not linking with libpthread, ensure usability of mutex as + an `in use' flag, see also the NO_THREADS case below. Assume + pthread_mutex_t is at least one int wide. */ + #define mutex_init(m) \ - (__pthread_mutex_init != NULL ? __pthread_mutex_init (m, NULL) : 0) + (__pthread_mutex_init != NULL \ + ? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0)) #define mutex_lock(m) \ - (__pthread_mutex_lock != NULL ? __pthread_mutex_lock (m) : 0) + (__pthread_mutex_lock != NULL \ + ? __pthread_mutex_lock (m) : ((*(int *)(m) = 1), 0)) #define mutex_trylock(m) \ - (__pthread_mutex_trylock != NULL ? __pthread_mutex_trylock (m) : 0) + (__pthread_mutex_trylock != NULL \ + ? __pthread_mutex_trylock (m) : (*(int *)(m) ? 1 : ((*(int *)(m) = 1), 0))) #define mutex_unlock(m) \ - (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (m) : 0) + (__pthread_mutex_unlock != NULL \ + ? __pthread_mutex_unlock (m) : (*(int*)(m) = 0)) #define thread_atfork(prepare, parent, child) \ (__pthread_atfork != NULL ? __pthread_atfork(prepare, parent, child) : 0) |