cross platform alternative for signal.SIGALRM?
Christian Gollwitzer
auriocus at gmx.de
Thu Nov 12 01:43:57 EST 2015
Am 12.11.15 um 07:14 schrieb Marko Rauhamaa:
> Terry Reedy <tjreedy at udel.edu>:
>
>> The cross-platform 3.4 asyncio module has some functions with
>> timeouts.
>
> Even that doesn't forcefully interrupt an obnoxious blocking function
> call like
>
> time.sleep(10000)
A blocking call - granted. But what happens in a blocking loop, i.e.
for i in range(10000000000000000000000000):
pass
?
My understanding of async is that it creates an event loop. In which
case the loop has no chance to run within a block of code that computes
anything, is that correct? Or does it hook into the interpreter and is
able to interrupt the program between bytecodes?
> I'm thinking the only portable way is to run a watchdog process with
> subprocess or multiprocessing.
What about a thread which calls exit() after the timeout? Does that
forcefully kill the whole process?
Christian
More information about the Python-list
mailing list