unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Cramer <crayc@pyro.net>
Cc: guile-devel@gnu.org
Subject: Re: [pthreads] performance test using fib.scm
Date: Wed, 11 Dec 2002 14:05:43 -0600	[thread overview]
Message-ID: <20021211140543.A21053@kiwi.pyrotechnics.com> (raw)
In-Reply-To: <xy7fzt5tz2a.fsf@nada.kth.se>; from djurfeldt@nada.kth.se on Tue, Dec 10, 2002 at 09:10:37PM +0100

On Tue, Dec 10, 2002 at 09:10:37PM +0100, Mikael Djurfeldt wrote:
> Wolfgang Jaehrling <pro-linux@gmx.de> 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  <mdj@kvast.blakulla.net>
> 
> 	* 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 <crayc@pyro.net> <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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2002-12-11 20:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10 18:16 [pthreads] performance test using fib.scm Mikael Djurfeldt
2002-12-10 21:10 ` Wolfgang Jaehrling
2002-12-10 20:10   ` Mikael Djurfeldt
2002-12-11 20:05     ` Christopher Cramer [this message]
2002-12-11  5:02   ` Maciej Stachowiak
2002-12-11  7:11     ` Mikael Djurfeldt
2002-12-11 13:48       ` Maciej Stachowiak
2002-12-11 23:43         ` Han-Wen Nienhuys
2002-12-11 16:59       ` Wolfgang Jaehrling
     [not found] ` <200212110202.gBB22Et27423@mule.m17n.org>
2002-12-11 17:27   ` Wolfgang Jaehrling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021211140543.A21053@kiwi.pyrotechnics.com \
    --to=crayc@pyro.net \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).