diff options
author | Eric Andersen <andersen@codepoet.org> | 2006-12-07 23:24:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2006-12-07 23:24:02 +0000 |
commit | 1478c2de052374c6356db5513749a144c13791b1 (patch) | |
tree | 3b22a3f8361f94c99508c497e240ecb71acf8641 /libc/stdlib/malloc-standard/malloc.h | |
parent | 99d6c367c4820a072dc4ada51561df17e2093778 (diff) |
Major cleanup of internal mutex locking. Be more consistant in how we do
things, and avoid potential deadlocks caused when a thread holding a uClibc
internal lock get canceled and terminates without releasing the lock. This
change also provides a single place, bits/uClibc_mutex.h, for thread libraries
to modify to change all instances of internal locking.
Diffstat (limited to 'libc/stdlib/malloc-standard/malloc.h')
-rw-r--r-- | libc/stdlib/malloc-standard/malloc.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 556aef4d7..389f1f7d4 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -22,18 +22,17 @@ #include <malloc.h> #include <stdlib.h> #include <sys/mman.h> +#include <bits/uClibc_mutex.h> libc_hidden_proto(mmap) libc_hidden_proto(sysconf) libc_hidden_proto(sbrk) libc_hidden_proto(abort) -#ifdef __UCLIBC_HAS_THREADS__ -# include <pthread.h> -extern pthread_mutex_t __malloc_lock; -#endif -#define LOCK __pthread_mutex_lock(&__malloc_lock) -#define UNLOCK __pthread_mutex_unlock(&__malloc_lock) + +__UCLIBC_MUTEX_EXTERN(__malloc_lock); +#define __MALLOC_LOCK __UCLIBC_MUTEX_LOCK(__malloc_lock) +#define __MALLOC_UNLOCK __UCLIBC_MUTEX_UNLOCK(__malloc_lock) |