This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Patrick Fink
Recipients Devin Jeanpierre, Netto, Patrick Fink, amcnabb, georg.brandl, neologix, pitrou, pts, s7v7nislands, terry.reedy, tim.peters, vstinner
Date 2018-03-29.20:04:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522353900.03.0.467229070634.issue5315@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-03-29 20:05:00Patrick Finksetrecipients: + Patrick Fink, tim.peters, georg.brandl, terry.reedy, pitrou, amcnabb, vstinner, Devin Jeanpierre, pts, s7v7nislands, neologix, Netto
2018-03-29 20:05:00Patrick Finksetmessageid: <1522353900.03.0.467229070634.issue5315@psf.upfronthosting.co.za>
2018-03-29 20:05:00Patrick Finklinkissue5315 messages
2018-03-29 20:04:59Patrick Finkcreate