[issue11668] _multiprocessing.Connection.poll with timeout uses polling under Windows

Brian Curtin report at bugs.python.org
Sat Mar 26 05:09:59 CET 2011


Brian Curtin <brian at python.org> added the comment:

Attaching an initial patch implementing the same functionality but using WaitForMultipleObjects. Here's some details:

WFMO takes an array of objects to wait on, which is the pipe handle and sigint_event which is a handle to an event which gets set when CTRL-C is caught (see Modules/_multiprocessing/multiprocessing.c). Waiting for both objects replaces the need to write a custom loop which periodically calls PyErr_CheckSignals.

A negative timeout was effectively a blocking call, so we can let WFMO handle that with an INFINITE timeout setting.

WFMO returns the object which raised it relative from event 0, so the switch case for a CTRL-C is 0+1 and returns the same value as before. If the pipe was the object to raise, just like before: return true if there's data, false if not.

----------
keywords: +patch
Added file: http://bugs.python.org/file21405/issue11668.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11668>
_______________________________________


More information about the Python-bugs-list mailing list