guile-devel
[Top][All Lists]
Advanced

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

Re: Recursive mutexes?


From: Rob Browning
Subject: Re: Recursive mutexes?
Date: Sun, 27 Oct 2002 12:44:55 -0600
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu)

Marius Vollmer <address@hidden> writes:

> I meant: there is a good reason that waiting on a condition variable
> requires you to have a locked mutex that is the atomically unlocked.
> Without this, I guess you will have a hard time avoiding race
> conditions.  Using mutexes in a strange way to simulate this is
> probably wrong.

Ahh, right.  I presume you mean the deadlock case of blocking after
you've already been signalled -- yeah mutexes (at least posix style)
aren't the best thing there, but I'd generally use a 0 token sempahore
for that.  Then if you're the one about to block, the signaller will
either already have deposited the token, or will after you block.

I have to keep reminding myself that mutexes aren't semaphores here.
I keep forgetting that because I did a whole lot of thread programming
in a system where we arranged for mutexes to be a special case
(one-token) semaphore.  This meant it was supposed to be OK for others
to signal, etc.

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD




reply via email to

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