From a09a6de23d724dc7cae9b5bf9dfb82205331a59a Mon Sep 17 00:00:00 2001 From: Nick Banks Date: Thu, 26 Sep 2024 08:19:34 -0400 Subject: [PATCH] Don't Access Volatile Variables Directly (#4561) --- src/perf/lib/Tcp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/perf/lib/Tcp.cpp b/src/perf/lib/Tcp.cpp index 3086a2496f..9d71308c5c 100644 --- a/src/perf/lib/Tcp.cpp +++ b/src/perf/lib/Tcp.cpp @@ -199,7 +199,7 @@ bool TcpWorker::Initialize(TcpEngine* _Engine, uint16_t PartitionIndex) Engine = _Engine; ExecutionContext.Callback = DoWork; ExecutionContext.Context = this; - ExecutionContext.Ready = TRUE; + InterlockedFetchAndSetBoolean(&ExecutionContext.Ready); // TODO - Use WriteBooleanNoFence equivalent instead? ExecutionContext.NextTimeUs = UINT64_MAX; #ifndef _KERNEL_MODE // Not supported on kernel mode @@ -282,7 +282,7 @@ TcpWorker::DoWork( if (Connection) { Connection->Process(); Connection->Release(); - This->ExecutionContext.Ready = TRUE; // We just did work, let's keep this thread hot. + InterlockedFetchAndSetBoolean(&This->ExecutionContext.Ready); // We just did work, let's keep this thread hot. State->NoWorkCount = 0; }