[issue5315] signal handler never gets called

Patrick Fink report at bugs.python.org
Thu Mar 29 16:05:00 EDT 2018


Patrick Fink <mail at pfink.de> added the comment:

A workaround to handle signals reliably that I successfully tested now is to execute everything within a subthread and let the main thread just join this subthread. Like:

signal.signal(MY_SIGNAL, signal_handler)
threading.Thread(target = my_main_function)
thread.start()
thread.join()

Doing it like this, the main thread should always listen to signals disregarding whether the subthread is stuck.

----------
nosy: +Patrick Fink

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue5315>
_______________________________________


More information about the Python-bugs-list mailing list