aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-11-25 13:55:03 +0100
committerGitHub <noreply@github.com>2021-11-25 13:55:03 +0100
commit1f7584d24c9e50207d74de26be0771d8377ed695 (patch)
tree76bf2cc9b737d722d276f8188cf481e5e01a3e56 /src/libutil
parentd58f149140582330bc994d215e54b2a4fc1149ff (diff)
parent2970ca18bf36c02860396f83f6c9d1c06414eea5 (diff)
Merge pull request #5644 from tweag/fix-interrupted-data-race
Fix a minor data race with _isInterrupted
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc2
-rw-r--r--src/libutil/util.hh2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 5468d1ed1..defb77a10 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1205,7 +1205,7 @@ void closeOnExec(int fd)
//////////////////////////////////////////////////////////////////////
-bool _isInterrupted = false;
+std::atomic<bool> _isInterrupted = false;
static thread_local bool interruptThrown = false;
thread_local std::function<bool()> interruptCheck;
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 708e01cf8..0bdb37a79 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -337,7 +337,7 @@ void closeOnExec(int fd);
/* User interruption. */
-extern bool _isInterrupted;
+extern std::atomic<bool> _isInterrupted;
extern thread_local std::function<bool()> interruptCheck;