From 2970ca18bf36c02860396f83f6c9d1c06414eea5 Mon Sep 17 00:00:00 2001 From: Alex Shabalin Date: Wed, 24 Nov 2021 14:50:08 +0100 Subject: [PATCH] Fix a minor data race with _isInterrupted --- src/libutil/util.cc | 2 +- src/libutil/util.hh | 2 +- 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 _isInterrupted = false; static thread_local bool interruptThrown = false; thread_local std::function 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 _isInterrupted; extern thread_local std::function interruptCheck;