k_thread: Fix data race

TSan reports a data race between writing at cpp:1162 and reading at
h:262. Make the thread_state atomic to prevent this.
This commit is contained in:
lat9nq 2022-04-01 18:57:40 -04:00
parent 0f347eaf52
commit 831f022536
2 changed files with 4 additions and 3 deletions

View file

@ -5,6 +5,7 @@
#pragma once
#include <array>
#include <atomic>
#include <span>
#include <string>
#include <utility>
@ -751,7 +752,7 @@ private:
KAffinityMask original_physical_affinity_mask{};
s32 original_physical_ideal_core_id{};
s32 num_core_migration_disables{};
ThreadState thread_state{};
std::atomic<ThreadState> thread_state{};
std::atomic<bool> termination_requested{};
bool wait_cancelled{};
bool cancellable{};