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 | 1f553f46fb4f3c5eec631352cdd900a0709016af (patch) | |
tree | a231fba2c03b440becaea6c86a2702d0bfb0336e /util/system/spinlock.h | |
parent | c4de7efdedc25b49cbea74bd589eecb61b55b60a (diff) | |
download | ydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 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 af2630890a..9d1480130b 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_) |