As far as I can tell, POSIX has no language that covers this situation, so I’m 
tossing it out here for the hive mind...

Is there ANY situation where, for a given pthread condition variable, that 
using a different mutex as the interlock in two different calls to 
pthread_cond_wait() would EVER be legitimate usage?  I cannot come up with any 
scenario in which this would be appropriate, but who knows what some crazy 
applications might do.

POSIX for whatever dumb reason allows pthread_cond_signal() / 
pthread_cond_broadcast() without holding the interlock, but at least there’s 
explicit language about this in the spec (and thankfully the language contains 
a mild finger-wag about it).  But as I said, the spec is silent on this 
particular question, and hopefully it’s because the answer is “NO THAT IS A 
COMPLETELY STUPID THING TO DO AND ANY SELF RESPECTING THREAD LIBRARY WILL 
IMMEDIATELY CAST YOUR APPLICATION INTO THE NINTH CIRCLE OF HELL IF YOU TRY IT”.

What say you, smart people?

Merci d’avance.

-- thorpej

Reply via email to