sleep: Make variable written in signal handler volatile

No difference in practice, but it's tidier and protects us
if we ever use g_interrupted earlier in main -- in that case,
the compiler might chose to keep the variable in a register without
the volatile.

Found by @bugaevc, thanks!
This commit is contained in:
Nico Weber 2020-09-09 09:28:02 -04:00 committed by Andreas Kling
parent a7f786fc0a
commit a2a54f459f
Notes: sideshowbarker 2024-07-19 02:49:03 +09:00

View File

@ -30,7 +30,7 @@
#include <string.h>
#include <unistd.h>
static bool g_interrupted;
static volatile bool g_interrupted;
static void handle_sigint(int)
{
g_interrupted = true;