guile-devel
[Top][All Lists]
Advanced

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

Re: Recursive mutexes?


From: Marius Vollmer
Subject: Re: Recursive mutexes?
Date: 27 Oct 2002 02:35:54 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Rob Browning <address@hidden> writes:

> > I think we should make our mutexes be recursive by default.  Expecting
> > to block when locking a mutex that is already lcoked by one self is
> > not very useful, since no one can unlock that mutex (excepts asyncs).
> 
> Though people coming from POSIX threads (at least under glibc) will
> be used to having to explicitly ask for recursive mutexes,

I am confused by the libc docs: what is a "timed" mutex?  Is it
recursive or not?  I just checked a little test program and the
default pthread mutexes seem to be recursive, on GNU/Linux.  "Fast"
mutixes are not resursive but you have to ask for them.

> Would it be hard to provide both and let the user select at creation
> time?

No.  But what about having two sets of locking/unlocking functions:
one that behaves recursivly, and one that doesn't?

> > SRFI-18 specifies non-recursive mutexes and allows non-owning threads
> > to unlock a mutex.  Such uses of a mutex are, in my view, a mockery of
> > condition variables should be avoided.
> 
> Well you certainly could use a condition variable instead of a mutex
> here, but I would suspect that in cases where you just want to wake
> someone else up, a mutex others can unlock would be lighter weight.
> With a condition variable you have to have both a mutex and the
> condition variable.

And for a good reason, no?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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