Using printf as a C reentry function

I work with several processes and signals, and yesterday I found out that printf is not a re-entry function, so there is a risk with signal handlers. Can i do something? Is there any possibility of re-entering printf or any re-call that can replace printf?

Thanks!

+5
source share
1 answer

Signal processors are generally quite complex. It is so very complicated that usually the only safe operation that must be performed inside them is to set the flag β€œreceived signal”, and then let the main loop (or in a multi-threaded application a special signal processing stream) of the program perform the actual signal processing.

+4
source

Source: https://habr.com/ru/post/1258054/


All Articles