Boost logo

Boost :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2005-09-17 13:12:23


Alexander Terekhov wrote:
> Yuval Ronen wrote:
> [...]
>
>>pthread_cond_wait(). Is this a problem? Is there any reference to the
>>difference between a condition with recursive mutex to a condition with
>>non-recursive mutex?
>
>
> http://lists.boost.org/Archives/boost/2004/07/68013.php

As far as I could understand from this, the POSIX standard specifies
that calling pthread_cond_wait() with a recursively locked mutex
(lock_count > 1) is forbidden and yields undefined behaviour. Is this
reasonable? This question should probably be addressed to the POSIX
guys, but since you're an expert, I'd like to hear your opinion. Is
there a good reason to not supplying full support for
condition-variables with recursive mutexes? To me it sounds like a
reasonable use case.

And if using a c.v. with recursive mutex is a bad idea, then why not
forbid it altogether? The current specification of "it's ok to use a
recursive mutex as long as it's used as a non-recursive mutex" is
especially weird to me...

Thanks a lot for your comments,
Yuval


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk