From 268ebbaffdffe8c622b1d5f0e2b66d49a594a87d Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Sun, 26 Jun 2022 13:04:49 -0700 Subject: [PATCH] Mark bools in BasicThread as atomic to avoid data races --- src/threading/BasicThread.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/threading/BasicThread.h b/src/threading/BasicThread.h index 3c5d3de1e8..f665462cbe 100644 --- a/src/threading/BasicThread.h +++ b/src/threading/BasicThread.h @@ -4,6 +4,7 @@ #include "zeek/zeek-config.h" #include +#include #include #include @@ -201,8 +202,8 @@ private: const char* name; std::thread thread; bool started; // Set to to true once running. - bool terminating; // Set to to true to signal termination. - bool killed; // Set to true once forcefully killed. + std::atomic_bool terminating; // Set to to true to signal termination. + std::atomic_bool killed; // Set to true once forcefully killed. // For implementing Fmt(). uint32_t buf_len;