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_free.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libc/stdlib/malloc/heap_free.c') diff --git a/libc/stdlib/malloc/heap_free.c b/libc/stdlib/malloc/heap_free.c index e958f920d..6084b43c3 100644 --- a/libc/stdlib/malloc/heap_free.c +++ b/libc/stdlib/malloc/heap_free.c @@ -23,8 +23,6 @@ __heap_free (struct heap *heap, void *mem, size_t size) struct heap_free_area *prev_fa, *fa; void *end = (char *)mem + size; - __heap_lock (heap); - HEAP_DEBUG (heap, "before __heap_free"); /* Find an adjacent free-list entry. */ @@ -59,8 +57,8 @@ __heap_free (struct heap *heap, void *mem, size_t size) /* See if FA can now be merged with its successor. */ if (next_fa && mem + size == HEAP_FREE_AREA_START (next_fa)) + /* Yup; merge FA's info into NEXT_FA. */ { - /* Yup; merge FA's info into NEXT_FA. */ fa_size += next_fa->size; __heap_link_free_area_after (heap, next_fa, prev_fa); fa = next_fa; @@ -92,7 +90,5 @@ __heap_free (struct heap *heap, void *mem, size_t size) done: HEAP_DEBUG (heap, "after __heap_free"); - __heap_unlock (heap); - return fa; } -- cgit v1.2.3