Eryk Sun added the comment:

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

----------
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29256>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to