diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-05 20:48:20 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-18 22:29:15 +0200 |
commit | be320a9e10fda32a984b12cdfe3aaf09cc67b39a (patch) | |
tree | f2bb28be6adc2a416b59393bb8f438636e9c79c1 /src/common/spin_lock.cpp | |
parent | Tests: Add tests for fibers and refactor/fix Fiber class (diff) | |
download | yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.gz yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.bz2 yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.lz yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.xz yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.zst yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/spin_lock.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/spin_lock.cpp b/src/common/spin_lock.cpp index 8077b78d2..82a1d39ff 100644 --- a/src/common/spin_lock.cpp +++ b/src/common/spin_lock.cpp @@ -43,4 +43,11 @@ void SpinLock::unlock() { lck.clear(std::memory_order_release); } +bool SpinLock::try_lock() { + if (lck.test_and_set(std::memory_order_acquire)) { + return false; + } + return true; +} + } // namespace Common |