aboutsummaryrefslogtreecommitdiffstats
path: root/util/thread/lfstack.h
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit8cbc307de0221f84c80c42dcbe07d40727537e2c (patch)
tree625d5a673015d1df891e051033e9fcde5c7be4e5 /util/thread/lfstack.h
parent30d1ef3941e0dc835be7609de5ebee66958f215a (diff)
downloadydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/thread/lfstack.h')
-rw-r--r--util/thread/lfstack.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/util/thread/lfstack.h b/util/thread/lfstack.h
index ca3d95f3c3..bfdb9f6879 100644
--- a/util/thread/lfstack.h
+++ b/util/thread/lfstack.h
@@ -16,7 +16,7 @@ class TLockFreeStack: TNonCopyable {
template <class U>
explicit TNode(U&& val)
: Value(std::forward<U>(val))
- , Next(nullptr)
+ , Next(nullptr)
{
}
};
@@ -31,7 +31,7 @@ class TLockFreeStack: TNonCopyable {
return;
if (AtomicAdd(DequeueCount, 0) == 1) {
// node current is in free list, we are the last thread so try to cleanup
- if (AtomicCas(&FreePtr, (TNode*)nullptr, current))
+ if (AtomicCas(&FreePtr, (TNode*)nullptr, current))
EraseList(current);
}
}
@@ -57,8 +57,8 @@ class TLockFreeStack: TNonCopyable {
public:
TLockFreeStack()
- : Head(nullptr)
- , FreePtr(nullptr)
+ : Head(nullptr)
+ , FreePtr(nullptr)
, DequeueCount(0)
{
}
@@ -127,7 +127,7 @@ public:
void DequeueAll(TCollection* res) {
AtomicAdd(DequeueCount, 1);
for (TNode* current = AtomicGet(Head); current; current = AtomicGet(Head)) {
- if (AtomicCas(&Head, (TNode*)nullptr, current)) {
+ if (AtomicCas(&Head, (TNode*)nullptr, current)) {
for (TNode* x = current; x;) {
res->push_back(std::move(x->Value));
x = x->Next;
@@ -171,7 +171,7 @@ public:
template <typename TCollection>
void DequeueAllSingleConsumer(TCollection* res) {
for (TNode* current = AtomicGet(Head); current; current = AtomicGet(Head)) {
- if (AtomicCas(&Head, (TNode*)nullptr, current)) {
+ if (AtomicCas(&Head, (TNode*)nullptr, current)) {
for (TNode* x = current; x;) {
res->push_back(std::move(x->Value));
x = x->Next;
@@ -182,7 +182,7 @@ public:
}
}
bool IsEmpty() {
- AtomicAdd(DequeueCount, 0); // mem barrier
+ AtomicAdd(DequeueCount, 0); // mem barrier
return AtomicGet(Head) == nullptr; // without lock, so result is approximate
}
};