Richard Oudkerk <shibt...@gmail.com> added the comment:

> It's an interesting article Richard, but I don't see how their 2nd attempt 
> solves the problem.  All it does is block the thread doing the Signal(), 
> not other threads, from stealing the wakeup.

Do you mean the listing on page 5?  (The earlier attempts were failures.)  The 
signalling thread holds the lock "x" while issuing the signal "s.V()" and 
waiting for notification of wakeup "h.P()".  A new thread cannot steal the 
wakeup because it needs to acquire the lock "x" before it can start its wait.

Of course, if the main mutex is always held when doing signal()/broadcast() 
then the lock "x" is unnecessary.

I don't think trying to do a full emulation is necessary.  Better to just 
document the limitations.

----------

_______________________________________
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