|
Boost : |
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-09-15 13:06:49
James Ahlborn <james.ahlborn_at_[hidden]> wrote:
> hey,
> I was wondering if any of the boost developers could tell me
> if recursive mutexes are supposed to work with conditions?
I don't believe so. If waiting for a condition releases the mutex
only once, this can result in deadlock, and if it releases the mutex
completely the protected data can be seen while its invariant is
broken. There seems to be no right way to use recursive mutexes with
condition variables.
<snip>
> I'm testing this on red hat 7.3 and fedora core 2. My guess as to
> why it's broken is because the boost condition uses posix recursive
> mutexes
There's no such thing.
> internally, which also seem to fail the recursive mutex/condition
> test (at least on the OS's mentioned above). Anyone have any
> thoughts on this?
<snip>
I think you should avoid using recursive mutexes. Read
<http://groups.google.com/groups?selm=3434E6BA.ABD%40zko.dec.com>.
Ben.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk