diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/system/spinlock.h | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/spinlock.h')
-rw-r--r-- | util/system/spinlock.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/util/system/spinlock.h b/util/system/spinlock.h index 9d1480130b..af2630890a 100644 --- a/util/system/spinlock.h +++ b/util/system/spinlock.h @@ -3,29 +3,29 @@ #include "atomic.h" #include "spin_wait.h" -class TSpinLockBase { +class TSpinLockBase { protected: inline TSpinLockBase() noexcept { AtomicSet(Val_, 0); } - + public: inline bool IsLocked() const noexcept { return AtomicGet(Val_); } - + inline bool TryAcquire() noexcept { return AtomicTryLock(&Val_); } - + inline bool try_lock() noexcept { return TryAcquire(); } protected: TAtomic Val_; -}; - +}; + static inline void SpinLockPause() { #if defined(__GNUC__) #if defined(_i386_) || defined(_x86_64_) |