Call a standard library function in a signal handler

Why is calling a standard library function inside a signal handler not recommended?

+5
source share
4 answers

This is explained in the GNU LibC documentation .

If you call a function in a handler, make sure that it is reentrant with respect to the signals, or make sure that the signal cannot interrupt the call to the corresponding function.

And just in case, here is the Wikipedia page on reentrant functions.

, , (.. ).

+11

, , , malloc() (, asprintf()) (.. printf()).

+1

, , :)

man 7 signal , . POSIX.

+1

.

0

All Articles