Message285497
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 |
|
Date |
User |
Action |
Args |
2017-01-14 19:42:36 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, njs, zach.ware, steve.dower |
2017-01-14 19:42:36 | eryksun | set | messageid: <1484422956.61.0.039871250519.issue29256@psf.upfronthosting.co.za> |
2017-01-14 19:42:36 | eryksun | link | issue29256 messages |
2017-01-14 19:42:36 | eryksun | create | |
|