diff options
author | agri <agri@yandex-team.ru> | 2022-02-10 16:48:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:12 +0300 |
commit | d3530b2692e400bd4d29bd4f07cafaee139164e7 (patch) | |
tree | b7ae636a74490e649a2ed0fdd5361f1bec83b9f9 /util/generic/refcount.h | |
parent | 0f4c5d1e8c0672bf0a1f2f2d8acac5ba24772435 (diff) | |
download | ydb-d3530b2692e400bd4d29bd4f07cafaee139164e7.tar.gz |
Restoring authorship annotation for <agri@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/refcount.h')
-rw-r--r-- | util/generic/refcount.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/util/generic/refcount.h b/util/generic/refcount.h index 966e853b77f..bcee5a78605 100644 --- a/util/generic/refcount.h +++ b/util/generic/refcount.h @@ -19,21 +19,21 @@ public: Check(); } - inline TAtomicBase Add(TAtomicBase d) noexcept { + inline TAtomicBase Add(TAtomicBase d) noexcept { Check(); - return Counter_ += d; + return Counter_ += d; } - inline TAtomicBase Inc() noexcept { - return Add(1); + inline TAtomicBase Inc() noexcept { + return Add(1); } - inline TAtomicBase Sub(TAtomicBase d) noexcept { + inline TAtomicBase Sub(TAtomicBase d) noexcept { Check(); return Counter_ -= d; } - inline TAtomicBase Dec() noexcept { + inline TAtomicBase Dec() noexcept { return Sub(1); } @@ -43,17 +43,17 @@ public: } Inc(); - Y_ASSERT(Counter_ != 0); - + Y_ASSERT(Counter_ != 0); + return true; } - inline TAtomicBase Val() const noexcept { + inline TAtomicBase Val() const noexcept { return Counter_; } private: - TAtomicBase Counter_; + TAtomicBase Counter_; }; class TNoCheckPolicy { @@ -109,12 +109,12 @@ public: inline ~TAtomicCounter() = default; - inline TAtomicBase Add(TAtomicBase d) noexcept { - return AtomicAdd(Counter_, d); + inline TAtomicBase Add(TAtomicBase d) noexcept { + return AtomicAdd(Counter_, d); } - inline TAtomicBase Inc() noexcept { - return Add(1); + inline TAtomicBase Inc() noexcept { + return Add(1); } inline TAtomicBase Sub(TAtomicBase d) noexcept { @@ -138,7 +138,7 @@ public: } intptr_t newValue = curValue + 1; - Y_ASSERT(newValue != 0); + Y_ASSERT(newValue != 0); if (AtomicCas(&Counter_, newValue, curValue)) { return true; |