According to this site, one can use variables of type volatile sig_atomic_t inside a signal handler. Now my question is, would for example something like the fo
Unless your program is multithreaded, signal handlers never run concurrently with other code in your program, and they certainly never run concurrently with the code they've interrupted. Your code is fine as long as the signal sig is masked for the duration of the signal handler.