Mark bools in BasicThread as atomic to avoid data races

This commit is contained in:
Tim Wojtulewicz 2022-06-26 13:04:49 -07:00
parent f50777cdab
commit 268ebbaffd

View file

@ -4,6 +4,7 @@
#include "zeek/zeek-config.h" #include "zeek/zeek-config.h"
#include <stdint.h> #include <stdint.h>
#include <atomic>
#include <iosfwd> #include <iosfwd>
#include <thread> #include <thread>
@ -201,8 +202,8 @@ private:
const char* name; const char* name;
std::thread thread; std::thread thread;
bool started; // Set to to true once running. bool started; // Set to to true once running.
bool terminating; // Set to to true to signal termination. std::atomic_bool terminating; // Set to to true to signal termination.
bool killed; // Set to true once forcefully killed. std::atomic_bool killed; // Set to true once forcefully killed.
// For implementing Fmt(). // For implementing Fmt().
uint32_t buf_len; uint32_t buf_len;