summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_spin_lock.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-04-08 01:01:26 +0200
committerbunnei <bunneidev@gmail.com>2022-04-12 06:13:40 +0200
commit8deaac8bd1707f56f29d61e427ad53964a0920fd (patch)
treed17e4ed20b9249507ad587aa0eb82e277daff614 /src/core/hle/kernel/k_spin_lock.cpp
parentMerge pull request #8157 from lat9nq/kernel-races (diff)
downloadyuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar.gz
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar.bz2
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar.lz
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar.xz
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.tar.zst
yuzu-8deaac8bd1707f56f29d61e427ad53964a0920fd.zip
Diffstat (limited to 'src/core/hle/kernel/k_spin_lock.cpp')
-rw-r--r--src/core/hle/kernel/k_spin_lock.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/core/hle/kernel/k_spin_lock.cpp b/src/core/hle/kernel/k_spin_lock.cpp
index 4412aa4bb..4df2e5c1a 100644
--- a/src/core/hle/kernel/k_spin_lock.cpp
+++ b/src/core/hle/kernel/k_spin_lock.cpp
@@ -35,20 +35,15 @@ void ThreadPause() {
namespace Kernel {
void KSpinLock::Lock() {
- while (lck.test_and_set(std::memory_order_acquire)) {
- ThreadPause();
- }
+ lck.lock();
}
void KSpinLock::Unlock() {
- lck.clear(std::memory_order_release);
+ lck.unlock();
}
bool KSpinLock::TryLock() {
- if (lck.test_and_set(std::memory_order_acquire)) {
- return false;
- }
- return true;
+ return lck.try_lock();
}
} // namespace Kernel