From a2a54f459f4096041f6d98da7f6dd609d8127ff9 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 9 Sep 2020 09:28:02 -0400 Subject: [PATCH] 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! --- Userland/sleep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/sleep.cpp b/Userland/sleep.cpp index 025a144300..c21c06b814 100644 --- a/Userland/sleep.cpp +++ b/Userland/sleep.cpp @@ -30,7 +30,7 @@ #include #include -static bool g_interrupted; +static volatile bool g_interrupted; static void handle_sigint(int) { g_interrupted = true;