Pedro Franco de Carvalho <redd...@gmail.com> writes: > Assume a python program sets a handler function for the > `signal.SIGALRM` signal, and then schedules an alarm in T seconds with > `signal.alarm(T)`. > > Assume the program later cancels any scheduled alarm with `signal.alarm(0)`.
I do not think so. You might have a "race condition". I think of the following (hypothetical) situation: the alarm arrives while "signal.alarm(0)" processing has started but not yet finished. In this case, the alarm arrival will schedule the alarm handler activation - but, as "signal.alarm" is "C" implemented, the handler will not be activated immediately (but delayed until the next execution of Python code). -- https://mail.python.org/mailman/listinfo/python-list