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
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/actor/tasks.h
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 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 3eab200b38..31d35931d2 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");
}
};
-
+
}