Kristján Valur Jónsson added the comment: Hi there. Looking at the API docs today (https://msdn.microsoft.com/en-us/library/windows/desktop/ms686304(v=vs.85).aspx) it appears that the timeout case is documented. I'm fairly sure that it wasn't when I implemented it. There was a good reason for the "2" return code. The idea was: Either there was an error (-1) or we woke up. Since there are spurious wakeups and stolen wakeups, the predicate must be tested again anyway. The '2' return code would mean that the timeout condition should be tested by looking at some external clock.
Now, the api documentation is bad. Return value is BOOL. Nonzero means "success" (whatever that means) Failure means ´zero´ Timeout means FALSE and GetLastError() == ERROR_TIMEOUT If memory serves, FALSE == 0 on windows.... Anyway, I've been out of this part of the code for sufficient time for details to be blurry. My advise: 1) Check that the API of the function is indeed correct. 2) If there is no bulletproof way of distinguishing timeout from normal return, just consider all returns normal (remember, non-error return means that we woke up, not that _we_ were signaled) 2) Verify that the code that is failing can indeed support spurious wakeups/stolen wakeups. It used to be that the python condition variables didn't have this property, because of the way they were implemented. This may have made people lazy. K ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29871> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com