
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?
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