unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-devel@gnu.org
Subject: Re: Recursive mutexes?
Date: 26 Oct 2002 22:39:28 +0100	[thread overview]
Message-ID: <m3k7k4g9rj.fsf@laruns.ossau.uklinux.net> (raw)
In-Reply-To: <87r8edos41.fsf@zagadka.ping.de>

>>>>> "Marius" == Marius Vollmer <mvo@zagadka.ping.de> writes:

    Marius> Our current coop mutexes are not 'recursive'.  This means that a
    Marius> thread blocks when it tries to lock a mutex that it already has
    Marius> locked.

    Marius> I think we should make our mutexes be recursive by default.  Expecting
    Marius> to block when locking a mutex that is already lcoked by one self is
    Marius> not very useful, since no one can unlock that mutex (excepts asyncs).

True, but a situation like this (the same thread trying to relock the
same mutex) can alert you to a programming error.  A dramatic problem
(the program hanging) is often more useful than the error being hidden.

    Marius> The only good argument against recursive mutexes that I can think of
    Marius> is a tiny performance gain since you don't need to do some checking.

IIRC, it's easy to implement a recursive mutex if you already have a
non-recursive one, but the reverse is not so easy.

    Marius> SRFI-18 specifies non-recursive mutexes and allows non-owning threads
    Marius> to unlock a mutex.

On first hearing, this sounds like it could be a useful feature.

    Marius> Such uses of a mutex are, in my view, a mockery of
    Marius> condition variables should be avoided.

I think you'll have to rephrase that! :-)

    Marius> If non-recursive mutexes turn out to be important, we can provide them
    Marius> as well, as an option.

I'm pretty sure they are important (enough), so I suggest that we
provide both.  What would be quite nice (and I think is possible)
would be to implement non-recursive mutexes in a
thread-implementation-specific way, and then recursive mutexes in a
generic way based on whatever non-recursive mutex is currently
configured.

        Neil



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


  reply	other threads:[~2002-10-26 21:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-26 20:35 Recursive mutexes? Marius Vollmer
2002-10-26 21:39 ` Neil Jerram [this message]
2002-10-27  0:03   ` Marius Vollmer
2002-10-27  1:20     ` Thomas Bushnell, BSG
2002-10-27 12:36       ` Marius Vollmer
2002-10-27  7:55     ` Neil Jerram
2002-10-27 18:33       ` Rob Browning
2002-10-26 22:16 ` Rob Browning
2002-10-26 22:29   ` Rob Browning
2002-10-26 22:42   ` Tom Lord
2002-10-26 23:26     ` Thomas Bushnell, BSG
2002-10-26 23:35       ` Tom Lord
2002-10-26 23:50         ` Tom Lord
2002-10-27  1:18           ` Thomas Bushnell, BSG
2002-10-26 22:47   ` Tom Lord
2002-10-27  8:33     ` Neil Jerram
2002-10-27 17:21       ` Tom Lord
2002-10-27  0:35   ` Marius Vollmer
2002-10-27  4:36     ` Rob Browning
2002-10-27 11:32       ` Marius Vollmer
2002-10-27 18:44         ` Rob Browning

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=m3k7k4g9rj.fsf@laruns.ossau.uklinux.net \
    --to=neil@ossau.uklinux.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).