When discussing signal handlers and logging in Python , the question of which functions are repeaters in Python arose in my mind.
The signal library mentions:
Although Python signal handlers are asynchronous, since the Python user is concerned, they can only occur between atomic instructions of the Python translator. This means that arrival signals during lengthy calculations are implemented exclusively in C (for example, regular expressions match on large texts) can be delayed for an arbitrary amount of time.
This reentry is not typical, indicated in the journal library :
If you run asynchronous signal handlers using a signal module, you may not be able to use logging from such handlers. This is due to the fact that blocking in the stream module is not always re-entry and therefore cannot be called from such signal handlers.
I'm a little confused because the signal library speaks of GIL (global blocking of the interpreter) as ".. between atomic instructions ..". In this case, the signals are delayed and executed as soon as the GIL is left / unlocked. View of the signal queue.
This makes sense, but it doesn’t matter if the functions that are called by the delayed signal handler are because they are not called in the real POSIX signal handler with a “retry” definition:
Only a specific list of POSIX C functions is re-declared and can be called in a POSIX signal handler. IEEE Std 1003.1 Lists 118 of the repeated UNIX functions that you find at https://www.opengroup.org/ (login required).
python
Raphael Bossek
source share