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 following code still be atomic and thus introduce no race conditions?
Assume that we are using a multicore processor (EDIT: running a multithreaded program). Does volatile sig_atomic_t
even work for multicore systems in the first place or should we use the atomic<unsigned int>
of C++11 for signal handlers on a multicore system (EDIT: running a multithreaded program)?
volatile sig_atomic_t a;
static void signal_handler(int sig, siginfo_t *si, void *unused)
{
int b;
................
b = ...;
a = a | b;
................
}