summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-09-30 06:13:59 +0000
committerjb <jb@FreeBSD.org>1998-09-30 06:13:59 +0000
commit8d80497304344bdb9a8026712fe7a445eaf95b79 (patch)
tree7911fab9be57e3e26f0a9a95cfd3efee04751cca /lib/libc/stdlib/malloc.c
parent1a428cd399d6e4c136d8a34907f040592205aeca (diff)
downloadFreeBSD-src-8d80497304344bdb9a8026712fe7a445eaf95b79.zip
FreeBSD-src-8d80497304344bdb9a8026712fe7a445eaf95b79.tar.gz
Delete the XXX comments that refer to spinlock recursion. The malloc/free/
realloc functions check for recursion within the malloc code itself. In a thread-safe library, the single spinlock ensures that no two threads go inside the protected code at the same time. The thread implementation is responsible for ensuring that the spinlock does in fact protect malloc. There was a window of opportunity in which this was not the case. I'll fix that with a commit RSN.
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r--lib/libc/stdlib/malloc.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index db4a798..bc27525 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: malloc.c,v 1.41 1998/09/20 01:07:50 alex Exp $
+ * $Id: malloc.c,v 1.42 1998/09/23 21:26:04 dfr Exp $
*
*/
@@ -1068,7 +1068,6 @@ malloc(size_t size)
if (malloc_active++) {
wrtwarning("recursive call.\n");
malloc_active--;
- /*THREAD_UNLOCK();*/ /* XXX */
return (0);
}
if (!malloc_started)
@@ -1092,18 +1091,6 @@ free(void *ptr)
malloc_func = " in free():";
if (malloc_active++) {
wrtwarning("recursive call.\n");
- /*
- * XXX
- * Ideally the next two lines would be gone and free() would
- * exit below. Unfortunately our spinlock implementation
- * allows a particular thread to obtain a lock multiple times
- * without counting how many times said operation has been
- * performed. The practical upshot of which is a single unlock
- * causes all locks to be undone at once. For this reason,
- * we return without performing an unlock in the case of
- * recursion (see also the commented out THREAD_UNLOCK calls
- * in malloc & realloc).
- */
malloc_active--;
return;
} else {
@@ -1125,7 +1112,6 @@ realloc(void *ptr, size_t size)
if (malloc_active++) {
wrtwarning("recursive call.\n");
malloc_active--;
- /*THREAD_UNLOCK();*/ /* XXX */
return (0);
}
if (ptr && !malloc_started) {
OpenPOWER on IntegriCloud