From: David M. C. <co...@ph...> - 2006-08-24 23:42:33
|
On Aug 24, 2006, at 18:38 , Travis Oliphant wrote: > > You can already use the approach suggested: > > if (PyOS_InterruptOccurred()) goto error > > to handle interrupts. The drawback of this approach is that the loop > executes more slowly because a check for the interrupt occurs many > times > in the loop which costs time. > > The advantage is that it may work with threads (I'm not clear on > whether > or not PyOS_InterruptOccurred can be called without the GIL, though). It should be; it's pure C code: int PyOS_InterruptOccurred(void) { if (!interrupted) return 0; interrupted = 0; return 1; } (where interrupted is a static int). -- |>|\/|< /------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |