summaryrefslogtreecommitdiff
path: root/src/common/spin_lock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/spin_lock.cpp')
-rw-r--r--src/common/spin_lock.cpp7
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() {
43 lck.clear(std::memory_order_release); 43 lck.clear(std::memory_order_release);
44} 44}
45 45
46bool SpinLock::try_lock() {
47 if (lck.test_and_set(std::memory_order_acquire)) {
48 return false;
49 }
50 return true;
51}
52
46} // namespace Common 53} // namespace Common