aboutsummaryrefslogtreecommitdiffstats
path: root/util/thread/lfstack.h
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/thread/lfstack.h
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 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 bfdb9f6879..ca3d95f3c3 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
}
};