Since printf is not reentrant, it's not supposed to be safe to use it in a signal handler. But I've seen lots of example codes that uses printf this way.
So my question is: when do we need to avoid using printf in a signal handler, and is there a recommended replacement?