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, njs, paul.moore, steve.dower, tim.golden, zach.ware
Date 2017-01-14.19:42:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484422956.61.0.039871250519.issue29256@psf.upfronthosting.co.za>
In-reply-to
Content
Some WinSock functions are just dispatchers that call a provider function. The dispatch table is set up when WinSock (i.e. ws2_32.dll) calls the WSPStartup function [1] of a provider DLL (e.g. mswsock.dll). In the case of select(), it calls the socket provider's WSPSelect function [2]. It determines the provider from the first socket found in the order of readfds, writefds, and exceptfds. It fails if there isn't at least one socket from which it can determine the provider. Also, given this design, each socket in all three sets has to be from the same provider. 

In general, using a dummy socket isn't a good workaround for using select() to implement a sleep function. WSPSelect can't be interrupted (or rather, it can only be interrupted temporarily to execute an asynchronous procedure call that's queued to the thread via QueueUserAPC, after which it resumes waiting). If a script uses select() with a dummy socket to sleep on the main thread, the user won't be able to cancel the wait with Ctrl+C. It would be better in this case if select.select waited on the SIGINT event like the Windows implementation of time.sleep.

[1]: https://msdn.microsoft.com/en-us/library/ms742296
[2]: https://msdn.microsoft.com/en-us/library/ms742289
History
Date User Action Args
2017-01-14 19:42:36eryksunsetrecipients: + eryksun, paul.moore, tim.golden, njs, zach.ware, steve.dower
2017-01-14 19:42:36eryksunsetmessageid: <1484422956.61.0.039871250519.issue29256@psf.upfronthosting.co.za>
2017-01-14 19:42:36eryksunlinkissue29256 messages
2017-01-14 19:42:36eryksuncreate