summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.h
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-11-26 08:41:09 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-11-26 08:41:09 +0000
commit20cff295659e9bd1bee2c316ee17a53cad693ea2 (patch)
treed3681139c0c158406063fc9a1c590e041de14538 /libc/stdlib/malloc/malloc.h
parentd8ea341e64250c2f4636c559562e8904037eda74 (diff)
- revert 24148:24151
Diffstat (limited to 'libc/stdlib/malloc/malloc.h')
-rw-r--r--libc/stdlib/malloc/malloc.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h
index 609b89748..2afc3a805 100644
--- a/libc/stdlib/malloc/malloc.h
+++ b/libc/stdlib/malloc/malloc.h
@@ -130,21 +130,24 @@ extern int __malloc_mmb_debug;
/* Locking for multithreaded apps. */
-#if defined __UCLIBC_HAS_THREADS__ && defined __LINUXTHREADS_OLD__
+#ifdef __UCLIBC_HAS_THREADS__
# include <pthread.h>
# include <bits/uClibc_pthread.h>
# define MALLOC_USE_LOCKING
+typedef pthread_mutex_t malloc_mutex_t;
+# define MALLOC_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+
# ifdef MALLOC_USE_SBRK
/* This lock is used to serialize uses of the `sbrk' function (in both
malloc and free, sbrk may be used several times in succession, and
things will break if these multiple calls are interleaved with another
thread's use of sbrk!). */
-__UCLIBC_MUTEX_EXTERN(__malloc_sbrk_lock);
-# define __malloc_lock_sbrk() __UCLIBC_MUTEX_LOCK(__malloc_sbrk_lock)
-# define __malloc_unlock_sbrk() __UCLIBC_MUTEX_UNLOCK(__malloc_sbrk_lock)
+extern malloc_mutex_t __malloc_sbrk_lock;
+# define __malloc_lock_sbrk() __pthread_mutex_lock (&__malloc_sbrk_lock)
+# define __malloc_unlock_sbrk() __pthread_mutex_unlock (&__malloc_sbrk_lock)
# endif /* MALLOC_USE_SBRK */
#else /* !__UCLIBC_HAS_THREADS__ */
@@ -219,10 +222,9 @@ extern void __malloc_debug_printf (int indent, const char *fmt, ...);
/* The malloc heap. */
extern struct heap_free_area *__malloc_heap;
-#if defined __UCLIBC_HAS_THREADS__
-#include <bits/uClibc_mutex.h>
-__UCLIBC_MUTEX_EXTERN(__malloc_heap_lock);
+#ifdef __UCLIBC_HAS_THREADS__
+extern malloc_mutex_t __malloc_heap_lock;
#ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
-__UCLIBC_MUTEX_EXTERN(__malloc_mmb_heap_lock);
+extern malloc_mutex_t __malloc_mmb_heap_lock;
#endif
#endif