I understand that accessing static variables in signal handlers is undefined behaviour, unless the variable is declared as volatile sig_atomic_t
. I am, however, writing a program for a 64-bit machine, where sig_atomic_t happens to be 32-bit. Is there an long
equivalent of sig_atomic_t
which I can use?
I know that sig_atomic_t
is merely a typedef of int
, so maybe a volatile long
will do; I'm just not comfortable with doing anything that is specifically undefined behaviour.
Thanks!