From 9b38f4fc55607a92f7e4fee81a2c25c326f602f1 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 12 Jul 2020 21:27:24 -0300 Subject: 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. --- src/core/hle/kernel/scheduler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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: /// Scheduler lock mechanisms. bool is_locked{}; - Common::SpinLock inner_lock{}; + std::mutex inner_lock; std::atomic scope_lock{}; Core::EmuThreadHandle current_owner{Core::EmuThreadHandle::InvalidHandle()}; -- cgit v1.2.3