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 eryksun
Recipients eryksun, josh.r, kristjan.jonsson, paul.moore, pitrou, steve.dower, tim.golden, zach.ware
Date 2017-04-03.22:11:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491257512.68.0.513647768162.issue29971@psf.upfronthosting.co.za>
In-reply-to
Content
Alternatively we could use the SleepEx and WaitFor*Ex functions with alertable waits (i.e. using APCs) instead of the SIGINT Event. This avoids having to replace all single-object waits with multiple-object waits, and would even allow calling SleepEx in pysleep. 

That said, issue 29871 proposes to switch to the condition variable and SRW lock implementation, so first it needs to be decided whether to continue to use kernel waits or switch to conditional variables. Or maybe refactor to use condition variables in performance-critical code and otherwise use kernel waits, if that makes sense.

An orthogonal improvement is to have the signal handler call CancelSynchronousIo. This would entail handling ERROR_OPERATION_ABORTED in _winapi Readfile, WriteFile, and WaitNamedPipe by calling PyErr_CheckSignals. Also in _Py_Read and _Py_Write, if errno is EINVAL and the last Windows error is ERROR_OPERATION_ABORTED, it could manually set errno to EINTR.

Winsock waits (e.g. select) will remain a problem in any case. Winsock uses alertable waits, so a queued user-mode APC will be executed while it's waiting. But then it just resumes its original wait instead of failing with WSAEINTR.
History
Date User Action Args
2017-04-03 22:11:52eryksunsetrecipients: + eryksun, paul.moore, pitrou, kristjan.jonsson, tim.golden, zach.ware, steve.dower, josh.r
2017-04-03 22:11:52eryksunsetmessageid: <1491257512.68.0.513647768162.issue29971@psf.upfronthosting.co.za>
2017-04-03 22:11:52eryksunlinkissue29971 messages
2017-04-03 22:11:52eryksuncreate