From 275a4c4e6fd115a0eb4c7a15e9ac4a92414cd839 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 7 Dec 2006 23:24:19 +0000 Subject: 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. --- libc/stdlib/malloc/malloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libc/stdlib/malloc/malloc.h') diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index b41c4b08e..177d8c236 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -125,11 +125,11 @@ extern int __malloc_mmb_debug; /* Locking for multithreaded apps. */ #ifdef __UCLIBC_HAS_THREADS__ -# include +# include # define MALLOC_USE_LOCKING -typedef pthread_mutex_t malloc_mutex_t; +typedef __UCLIBC_MUTEX_TYPE malloc_mutex_t; # define MALLOC_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER # ifdef MALLOC_USE_SBRK @@ -138,8 +138,8 @@ typedef pthread_mutex_t malloc_mutex_t; things will break if these multiple calls are interleaved with another thread's use of sbrk!). */ 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) +# define __malloc_lock_sbrk() __UCLIBC_MUTEX_LOCK (&__malloc_sbrk_lock) +# define __malloc_unlock_sbrk() __UCLIBC_MUTEX_UNLOCK (&__malloc_sbrk_lock) # endif /* MALLOC_USE_SBRK */ #else /* !__UCLIBC_HAS_THREADS__ */ -- cgit v1.2.3