aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/actor/tasks.h
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/messagebus/actor/tasks.h
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
downloadydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/actor/tasks.h')
-rw-r--r--library/cpp/messagebus/actor/tasks.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/messagebus/actor/tasks.h b/library/cpp/messagebus/actor/tasks.h
index 31d35931d2..3eab200b38 100644
--- a/library/cpp/messagebus/actor/tasks.h
+++ b/library/cpp/messagebus/actor/tasks.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
#include <util/system/atomic.h>
-#include <util/system/yassert.h>
-
-namespace NActor {
+#include <util/system/yassert.h>
+
+namespace NActor {
class TTasks {
enum {
// order of values is important
@@ -11,27 +11,27 @@ namespace NActor {
E_RUNNING_NO_TASKS,
E_RUNNING_GOT_TASKS,
};
-
+
private:
TAtomic State;
-
+
public:
TTasks()
: State(E_WAITING)
{
- }
-
+ }
+
// @return true iff caller have to either schedule task or execute it
bool AddTask() {
// High contention case optimization: AtomicGet is cheaper than AtomicSwap.
if (E_RUNNING_GOT_TASKS == AtomicGet(State)) {
return false;
}
-
+
TAtomicBase oldState = AtomicSwap(&State, E_RUNNING_GOT_TASKS);
return oldState == E_WAITING;
- }
-
+ }
+
// called by executor
// @return true iff we have to recheck queues
bool FetchTask() {
@@ -44,5 +44,5 @@ namespace NActor {
Y_FAIL("unknown");
}
};
-
+
}