diff options
| author | bunnei <bunneidev@gmail.com> | 2022-04-11 20:57:32 -0700 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2022-04-11 21:15:38 -0700 |
| commit | 3f0b93925f082b6defe9454f16f1260539994217 (patch) | |
| tree | 2bfa8f2638bc70174ea8c921b20017996b51a253 /src/core/hle/kernel/k_thread.h | |
| parent | 965c05b43d9270b9085170db702dfaf4bcfe9e3d (diff) | |
core: hle: kernel: k_thread: Rework dummy thread waiting.
Diffstat (limited to 'src/core/hle/kernel/k_thread.h')
| -rw-r--r-- | src/core/hle/kernel/k_thread.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index c141fc11b..4892fdf76 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -6,6 +6,8 @@ #include <array> #include <atomic> +#include <condition_variable> +#include <mutex> #include <span> #include <string> #include <utility> @@ -257,11 +259,11 @@ public: [[nodiscard]] std::shared_ptr<Common::Fiber>& GetHostContext(); [[nodiscard]] ThreadState GetState() const { - return thread_state & ThreadState::Mask; + return thread_state.load(std::memory_order_relaxed) & ThreadState::Mask; } [[nodiscard]] ThreadState GetRawState() const { - return thread_state; + return thread_state.load(std::memory_order_relaxed); } void SetState(ThreadState state); @@ -643,7 +645,6 @@ public: // blocking as needed. void IfDummyThreadTryWait(); - void IfDummyThreadBeginWait(); void IfDummyThreadEndWait(); private: @@ -764,12 +765,13 @@ private: bool resource_limit_release_hint{}; StackParameters stack_parameters{}; Common::SpinLock context_guard{}; - KSpinLock dummy_wait_lock{}; // For emulation std::shared_ptr<Common::Fiber> host_context{}; bool is_single_core{}; ThreadType thread_type{}; + std::mutex dummy_wait_lock; + std::condition_variable dummy_wait_cv; // For debugging std::vector<KSynchronizationObject*> wait_objects_for_debugging; |
