aboutsummaryrefslogtreecommitdiff
path: root/malloc/thread-m.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-10 04:37:40 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-10 04:37:40 +0000
commite9b3e3c5ceec61f6af401b122434844321960eec (patch)
treecfdbd74ed29eb37cc3a0c1a7789f10be6de8a8d2 /malloc/thread-m.h
parent97e55a252e6d4eb39fe9904879e294fb96163733 (diff)
downloadglibc-e9b3e3c5ceec61f6af401b122434844321960eec.zip
glibc-e9b3e3c5ceec61f6af401b122434844321960eec.tar.gz
glibc-e9b3e3c5ceec61f6af401b122434844321960eec.tar.bz2
Update.
1999-12-09 Andreas Jaeger <aj@suse.de> * nis/nss_compat/compat-pwd.c (internal_getpwuid_r): Always set errno to ENOENT when returning NSS_STATUS_NOTFOUND. Reported by Christian Starkjohann <cs@obdev.at>. 1999-12-09 Andreas Jaeger <aj@suse.de> * sysdeps/i386/fpu/libm-test-ulps: Added some ulps. 1999-12-09 Jakub Jelinek <jakub@redhat.com> * stdlib/longlong.h: Update from latest egcs version. * sysdeps/sparc/fpu/fegetenv.c: Add semicolons. * sysdeps/unix/sysv/linux/bits/errno.h (__errno_location): __THROW has to preceede __attribute__, otherwise g++ barfs. * sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Make things compile on sparc64-*-linux. * sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Changed to use sigcontext. * sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise. 1999-12-05 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c (arena_get2): If generating a new arena fails, try to generate a minimal one and hope for mmap_chunk() to succeed later. 1999-11-07 Wolfram Gloger <wg@malloc.de> * malloc/thread-m.h [NO_THREADS]: The mutex_* macros now let mutex_t work as an `in-use' flag even without threads. * malloc/malloc.c (USE_ARENAS): New feature flag, controls support for multiple arenas separately from NO_THREADS. (mALLOc, chunk_realloc, mEMALIGn, cALLOc) [USE_ARENAS]: try to fall back to an mmap()ed arena when sbrk() has failed.
Diffstat (limited to 'malloc/thread-m.h')
-rw-r--r--malloc/thread-m.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/malloc/thread-m.h b/malloc/thread-m.h
index 1598db8..d5b1e2f 100644
--- a/malloc/thread-m.h
+++ b/malloc/thread-m.h
@@ -207,18 +207,24 @@ int tsd_key_next;
typedef int thread_id;
+/* The mutex functions used to do absolutely nothing, i.e. lock,
+ trylock and unlock would always just return 0. However, even
+ without any concurrently active threads, a mutex can be used
+ legitimately as an `in use' flag. To make the code that is
+ protected by a mutex async-signal safe, these macros would have to
+ be based on atomic test-and-set operations, for example. */
typedef int mutex_t;
#define MUTEX_INITIALIZER 0
#define mutex_init(m) (*(m) = 0)
-#define mutex_lock(m) (0)
-#define mutex_trylock(m) (0)
-#define mutex_unlock(m) (0)
+#define mutex_lock(m) ((*(m) = 1), 0)
+#define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
+#define mutex_unlock(m) (*(m) = 0)
typedef void *tsd_key_t;
#define tsd_key_create(key, destr) do {} while(0)
-#define tsd_setspecific(key, data) do {} while(0)
-#define tsd_getspecific(key, vptr) (vptr = NULL)
+#define tsd_setspecific(key, data) ((key) = (data))
+#define tsd_getspecific(key, vptr) (vptr = (key))
#define thread_atfork(prepare, parent, child) do {} while(0)