mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Mark MsgThread::cnt_sent_{in,out} as atomic to avoid a data race
This commit is contained in:
parent
a2ab1b1484
commit
4dc20826fd
2 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "zeek/DebugLogger.h"
|
||||
#include "zeek/threading/BasicThread.h"
|
||||
#include "zeek/threading/Queue.h"
|
||||
|
@ -335,8 +337,8 @@ private:
|
|||
Queue<BasicInputMessage *> queue_in;
|
||||
Queue<BasicOutputMessage *> queue_out;
|
||||
|
||||
uint64_t cnt_sent_in; // Counts message sent to child.
|
||||
uint64_t cnt_sent_out; // Counts message sent by child.
|
||||
std::atomic<uint64_t> cnt_sent_in; // Counts message sent to child.
|
||||
std::atomic<uint64_t> cnt_sent_out; // Counts message sent by child.
|
||||
|
||||
bool main_finished; // Main thread is finished, meaning child_finished propagated back through message queue.
|
||||
bool child_finished; // Child thread is finished.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue