summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_thread.h
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-04-16 00:05:04 +0200
committerGitHub <noreply@github.com>2022-04-16 00:05:04 +0200
commit34710065e84ccc3de4433b7dd0ffb569e14788b8 (patch)
tree5e96d11546befd9671dff252e8e9e8a693b0bd1a /src/core/hle/kernel/k_thread.h
parentMerge pull request #8190 from Docteh/palswap (diff)
parentcore: hle: kernel: k_thread: Rework dummy thread waiting. (diff)
downloadyuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar.gz
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar.bz2
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar.lz
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar.xz
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.tar.zst
yuzu-34710065e84ccc3de4433b7dd0ffb569e14788b8.zip
Diffstat (limited to 'src/core/hle/kernel/k_thread.h')
-rw-r--r--src/core/hle/kernel/k_thread.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index d0fd85130..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>
@@ -15,6 +17,7 @@
#include "common/common_types.h"
#include "common/intrusive_red_black_tree.h"
+#include "common/spin_lock.h"
#include "core/arm/arm_interface.h"
#include "core/hle/kernel/k_affinity_mask.h"
#include "core/hle/kernel/k_light_lock.h"
@@ -256,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);
@@ -642,7 +645,6 @@ public:
// blocking as needed.
void IfDummyThreadTryWait();
- void IfDummyThreadBeginWait();
void IfDummyThreadEndWait();
private:
@@ -762,13 +764,14 @@ private:
s8 priority_inheritance_count{};
bool resource_limit_release_hint{};
StackParameters stack_parameters{};
- KSpinLock context_guard{};
- KSpinLock dummy_wait_lock{};
+ Common::SpinLock context_guard{};
// 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;