Kristján Valur Jónsson <krist...@ccpgames.com> added the comment:

Right.
Without holding the mutex, the definition of "already blocked" is of course 
meaningless, since only the holding the mutex can define any ordering.
pthread standard indeed says "however, if predictable scheduling behaviour is 
required, then that mutex is locked by the thread calling pthread_cond_signal() 
or pthread_cond_broadcast()."

There are a number of implementations that are subjects to serious problems if 
the mutex isn't held when doing pthread_cond_signal(), including the notorious 
'lost wakeup' bug, eg:  
http://docs.oracle.com/cd/E19963-01/html/821-1601/sync-21067.html, so it is 
certainly recommended practice to use pthread_cond_signal() with the mutex held 
regardless.

But you are right, the emulation implementation depends on the mutex not only 
for predicable scheduling but for synchronizing access to the internal state, 
and this should be documented.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15038>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to