
"Vukasin Toroman" <vtoroman@astaro.de> wrote in message news:418892BF.7070701@astaro.de...
It looks like a documentation bug to me.
in mho, if a bug exists than it is in design. if a recursive mutex should not be used in a condition the condition should not accept it.
They are intended to be used together.
this is either a design flaw (allowing the condition to accept recursive mutexes) or a implementation flaw (the condition should only unlock the recursive mutex once instead all the way).
I don't think that makes sense, though: recursive_mutex m; condition c; bool b; void f() { lock lock1(m); //... lock lock2(m); //Recursive lock while (!b) c.wait(lock2); //*** } At the point marked "***", the thread calling c.wait() (call it thread #1) is waiting for another thread (thread #2) to wake it up. Presumably thread #2 will want to read or modify the resource protected by m before doing so (otherwise there's not much point in thread #1 waiting for it), but it won't be able to because the mutex is still locked by thread #1. If it tries to obtain the mutex, deadlock results. Mike