This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients josh.r, kristjan.jonsson, paul.moore, steve.dower, tim.golden, zach.ware
Date 2017-03-22.09:11:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490173876.31.0.494984584557.issue29871@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-03-22 09:11:16kristjan.jonssonsetrecipients: + kristjan.jonsson, paul.moore, tim.golden, zach.ware, steve.dower, josh.r
2017-03-22 09:11:16kristjan.jonssonsetmessageid: <1490173876.31.0.494984584557.issue29871@psf.upfronthosting.co.za>
2017-03-22 09:11:16kristjan.jonssonlinkissue29871 messages
2017-03-22 09:11:15kristjan.jonssoncreate