diff options
| author | bunnei <bunneidev@gmail.com> | 2021-01-21 11:26:00 -0800 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2021-01-28 21:42:26 -0800 |
| commit | 37f74d87417c8cb491fee1681cc05fb7baa5e516 (patch) | |
| tree | 3a3f7bd10787666f6e4c81f3a8f6926ac5bf0da9 /src/core/hle/kernel/k_scheduler.h | |
| parent | f6b10fad6365be68e9c93b1396249c66910e785f (diff) | |
hle: kernel: k_scheduler: Use atomics for current_thread, etc.
Diffstat (limited to 'src/core/hle/kernel/k_scheduler.h')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index 2308a55be..e0d052593 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h @@ -54,7 +54,7 @@ public: /// Returns true if the scheduler is idle [[nodiscard]] bool IsIdle() const { - return GetCurrentThread() == idle_thread; + return GetCurrentThread() == idle_thread.get(); } /// Gets the timestamp for the last context switch in ticks. @@ -174,8 +174,9 @@ private: void SwitchToCurrent(); KThread* prev_thread{}; - KThread* current_thread{}; - KThread* idle_thread{}; + std::atomic<KThread*> current_thread{}; + + std::shared_ptr<KThread> idle_thread; std::shared_ptr<Common::Fiber> switch_fiber{}; |
