summaryrefslogtreecommitdiffstats
path: root/util/generic/refcount.h
diff options
context:
space:
mode:
authorartkolesnikov <[email protected]>2022-02-10 16:47:37 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:47:37 +0300
commit0d7c4ef9025d79c9bba6f62a92b490ee72e80ed0 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /util/generic/refcount.h
parent8611780b719073fe6c7e6536c71d61e20d57a5d6 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/generic/refcount.h')
-rw-r--r--util/generic/refcount.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 531db87022a..966e853b77f 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -38,16 +38,16 @@ public:
}
inline bool TryWeakInc() noexcept {
- if (!Counter_) {
- return false;
- }
-
- Inc();
+ if (!Counter_) {
+ return false;
+ }
+
+ Inc();
Y_ASSERT(Counter_ != 0);
- return true;
- }
-
+ return true;
+ }
+
inline TAtomicBase Val() const noexcept {
return Counter_;
}
@@ -130,22 +130,22 @@ public:
}
inline bool TryWeakInc() noexcept {
- while (true) {
- intptr_t curValue = Counter_;
-
- if (!curValue) {
- return false;
- }
-
- intptr_t newValue = curValue + 1;
+ while (true) {
+ intptr_t curValue = Counter_;
+
+ if (!curValue) {
+ return false;
+ }
+
+ intptr_t newValue = curValue + 1;
Y_ASSERT(newValue != 0);
-
- if (AtomicCas(&Counter_, newValue, curValue)) {
- return true;
- }
- }
- }
-
+
+ if (AtomicCas(&Counter_, newValue, curValue)) {
+ return true;
+ }
+ }
+ }
+
private:
TAtomic Counter_;
};