summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-07-12 21:27:24 -0300
committerGravatar ReinUsesLisp2020-07-12 21:27:24 -0300
commit9b38f4fc55607a92f7e4fee81a2c25c326f602f1 (patch)
tree3f5486ca7f48efbba00fe4b2bd1c0e5d2aee8964
parentMerge pull request #4318 from lioncash/cpp20 (diff)
downloadyuzu-9b38f4fc55607a92f7e4fee81a2c25c326f602f1.tar.gz
yuzu-9b38f4fc55607a92f7e4fee81a2c25c326f602f1.tar.xz
yuzu-9b38f4fc55607a92f7e4fee81a2c25c326f602f1.zip
kernel/scheduler: Use std::mutex instead of spin lock
Profiling shows that this is a highly contested mutex, causing dimishing results compared to a OS lock. std::mutex implementations can spin for a while before falling back to an OS lock. This avoids wasting precious CPU cycles in a no-op.
-rw-r--r--src/core/hle/kernel/scheduler.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/hle/kernel/scheduler.h b/src/core/hle/kernel/scheduler.h
index b3b4b5169..b9cad3f4a 100644
--- a/src/core/hle/kernel/scheduler.h
+++ b/src/core/hle/kernel/scheduler.h
@@ -188,7 +188,7 @@ private:
188 188
189 /// Scheduler lock mechanisms. 189 /// Scheduler lock mechanisms.
190 bool is_locked{}; 190 bool is_locked{};
191 Common::SpinLock inner_lock{}; 191 std::mutex inner_lock;
192 std::atomic<s64> scope_lock{}; 192 std::atomic<s64> scope_lock{};
193 Core::EmuThreadHandle current_owner{Core::EmuThreadHandle::InvalidHandle()}; 193 Core::EmuThreadHandle current_owner{Core::EmuThreadHandle::InvalidHandle()};
194 194