Message132215
| Author |
brian.curtin |
| Recipients |
asksol, brian.curtin, jnoller, kristjan.jonsson, pitrou, tim.golden |
| Date |
2011年03月26日.04:09:58 |
| SpamBayes Score |
2.2231907e-06 |
| Marked as misclassified |
No |
| Message-id |
<1301112599.9.0.556991061776.issue11668@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|