alan schrieb:
This ignores CTRL-C on every platform I've tested:
python -c "import threading; threading.Event().wait()"
^C^C^C^C
It looks to me like all signals are masked before entering wait(). Can
someone familiar with the internals explain and/or justify this
behavior? Thanks,
They aren't masked. Read the docs:
# Although Python signal handlers are called asynchronously as far as
the Python user is concerned, they can only occur between the ``atomic''
instructions of the Python interpreter. This means that signals arriving
during long calculations implemented purely in C (such as regular
expression matches on large bodies of text) may be delayed for an
arbitrary amount of time.
(http://docs.python.org/lib/module-signal.html)
Which is what is happening here - wait is implemented in C. So the
arriving signal is stored flagged in the interpreter so that the next
bytecode would be the signal-handler set - but the interpreter still
waits for the blocked call.
Diez
--
http://mail.python.org/mailman/listinfo/python-list