guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pthreads] performance test using fib.scm


From: Christopher Cramer
Subject: Re: [pthreads] performance test using fib.scm
Date: Wed, 11 Dec 2002 14:05:43 -0600
User-agent: Mutt/1.2.5i

On Tue, Dec 10, 2002 at 09:10:37PM +0100, Mikael Djurfeldt wrote:
> Wolfgang Jaehrling <address@hidden> writes:
> 
> > malloc() in glibc is thread-save, but not reentrant.  Since the
> > behaviour of realloc() is unlikely to differ from malloc() in this
> > respect, you most certainly have to protect calls to it with a lock.
> 
> 2002-12-10  Mikael Djurfeldt  <address@hidden>
> 
>       * gc-malloc.c (malloc_mutex): New mutex.
>       (scm_gc_init_malloc): Initialize it.
>       (scm_realloc): Serialize call to realloc
>       (scm_calloc): Same for calloc.
>       Thanks to Wolfgang Jaehrling!
>       (Now we have to make sure all calls to malloc/realloc are made
>       through scm_malloc.)

Every pthreads implementation is required to have a thread-safe malloc,
calloc, realloc and free (along with many other functions). The fact
that malloc etc. are non-reentrant only means that you shouldn't call
them from a signal handler.

Any pthreads implementation that requires you to lock a mutex to call
malloc is broken.

-- 
Christopher Cramer <address@hidden> <http://www.pyro.net/~crayc/>
"Gore would have finished ahead by the barest of margins had he pursued
and gained a complete statewide recount." -- Associated Press, 9/6/2002



reply via email to

[Prev in Thread] Current Thread [Next in Thread]