Currently, I use some non-signal safe functions such as fprintf, snprintfin my signal handlers. But I need to replace it with signaling safe functions like write. But the function writeuses only a buffer or string without formatting. Are there other methods for printing a formatted string?
fprintf
snprintf
write
Set the flag in the signal handler. Then make recordings for recording after returning from the signal handler.
static volatile sig_atomic_t sig_rcvd = 0; void sig_hanlder(int sig) { sig_rcvd = 1; }
sig_rcvd, , , reset sig_rcvd 0. - , , .
sig_rcvd
Source: https://habr.com/ru/post/1667341/More articles:Как диспетчер потоков JVM управляет потоками для мультипроцессоров? - javaEF6 with TransactionScope - IsolationLevel.ReadUnCommitted, but first got ReadCommitted - c #Use flexbox, is it safe to use? Use it everywhere, anytime? - cssException while reading millions of characters in a JSON file [OutOfMemoryException] - jsonError adding duplicate key to dictionary in script task - c #Silver finder can get PATTERN from file? - command-lineLimit number of positions in Quantstrat - rToday, the extension with UICollectionView is different compared to Single View - ioschange color DatePicker [Xamarin.Forms] - background-colorHow to compile Mac with Linux? - ubuntuAll Articles