glogg
glogg copied to clipboard
Fix signal handler
The function “exit” does not belong to the list of async-signal-safe functions. I guess that a different program design will be needed for your function “terminate”.
As far as I understand one of correct solutions would be blocking selected signals on all threads (doing this in main should work by inheritance?) and then using separate thread with sigwait to wait for signals. This thread is not a signal handler, so calling regular exit should be permitted.