fix(pibasetransfer): make shared flags std::atomic<bool> to eliminate data race

Flags break_, is_sending, is_receiving, is_pause are accessed from
both the send thread (send_process) and the read thread (received)
without synchronization. Plain bool reads/writes from multiple threads
is undefined behavior per C++ standard. Convert to std::atomic<bool>
with proper initializers.
This commit is contained in:
2026-08-10 15:48:24 +03:00
parent 1c9cdbba19
commit b180d91b1e
+3 -1
View File
@@ -28,6 +28,8 @@
#include "picrc.h"
#include "pidiagnostics.h"
#include <atomic>
//! \~\ingroup IO-Utils
//! \~\brief
@@ -301,7 +303,7 @@ protected:
bool send_process();
uint packet_header_size, part_header_size;
bool break_, is_sending, is_receiving, is_pause;
std::atomic<bool> break_{true}, is_sending{false}, is_receiving{false}, is_pause{false};
PIString state_string;
llong bytes_all, bytes_cur;