From 3668a2e4940ebe0e7c33729ad375a9a7b0c6ceb1 Mon Sep 17 00:00:00 2001 From: jasone Date: Thu, 12 Jan 2006 07:28:21 +0000 Subject: In preparation for a new malloc implementation: * Add posix_memalign(). * Move calloc() from calloc.c to malloc.c. Add a calloc() implementation in rtld-elf in order to make the loader happy (even though calloc() isn't used in rtld-elf). * Add _malloc_prefork() and _malloc_postfork(), and use them instead of directly manipulating __malloc_lock. Approved by: phk, markm (mentor) --- lib/libpthread/thread/thr_fork.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libpthread') diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c index fdbfd86..5445483 100644 --- a/lib/libpthread/thread/thr_fork.c +++ b/lib/libpthread/thread/thr_fork.c @@ -91,7 +91,7 @@ _fork(void) /* Fork a new process: */ if (_kse_isthreaded() != 0) { - _spinlock(__malloc_lock); + _malloc_prefork(); } if ((ret = __sys_fork()) == 0) { /* Child process */ @@ -107,8 +107,8 @@ _fork(void) } _thr_mutex_reinit(&_thr_atfork_mutex); } else { - if ((_kse_isthreaded() != 0) && (__malloc_lock != NULL)) { - _spinunlock(__malloc_lock); + if (_kse_isthreaded() != 0) { + _malloc_postfork(); } errsave = errno; if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) { -- cgit v1.1