summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/heap.h
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-07-25 01:58:57 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-07-25 01:58:57 +0000
commit056f9d98941eb98e453bf4fa308f28b892525baf (patch)
tree9adaefa6923b1949e06c4a81cf889976a7e8bb18 /libc/stdlib/malloc/heap.h
parent255cd531d67d4c5d110409e2a24e2aa5a6249a7a (diff)
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.
Diffstat (limited to 'libc/stdlib/malloc/heap.h')
-rw-r--r--libc/stdlib/malloc/heap.h19
1 files changed, 1 insertions, 18 deletions
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 <features.h>
-#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
-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