Right which is why you don't actually do much of anything in the signal handler except save that it happened somewhere to be processed by your application later.
https://docs.python.org/3/library/signal.html#execution-of-p...
Here's how Python does it.