From 056f9d98941eb98e453bf4fa308f28b892525baf Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 25 Jul 2002 01:58:57 +0000 Subject: Redo the locking, so that it may actually work. Now locking is done at the malloc/free level, not within the heap abstraction, and there's a separate lock to control sbrk access. Also, get rid of the separate `unmap_free_area' function in free.c, and just put the code in the `free' function directly, which saves a bunch of space (even compared to using an inline function) for some reason. --- libc/stdlib/malloc/heap.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'libc/stdlib/malloc/heap.h') diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 5207afe8e..445b012ce 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -14,21 +14,6 @@ #include -#ifdef __UCLIBC_HAS_THREADS__ -#include -typedef pthread_mutex_t heap_mutex_t; -# define HEAP_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER -# define __heap_lock(heap) pthread_mutex_lock (&(heap)->lock) -# define __heap_unlock(heap) pthread_mutex_unlock (&(heap)->lock); -#else -/* Without threads, Mutex operations are a nop. */ -typedef int heap_mutex_t; -# define HEAP_MUTEX_INIT 0 -# define __heap_lock(heap) -# define __heap_unlock(heap) -#endif - - /* The heap allocates in multiples of, and aligned to, HEAP_GRANULARITY. HEAP_GRANULARITY must be a power of 2. Malloc depends on this being the same as MALLOC_ALIGNMENT. */ @@ -41,10 +26,8 @@ struct heap { /* A list of memory in the heap available for allocation. */ struct heap_free_area *free_areas; - - heap_mutex_t lock; }; -#define HEAP_INIT { 0, HEAP_MUTEX_INIT } +#define HEAP_INIT { 0 } /* A free-list area `header'. These are actually stored at the _ends_ of -- cgit v1.2.3