diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/local_tasks.h | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/local_tasks.h')
-rw-r--r-- | library/cpp/messagebus/local_tasks.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/messagebus/local_tasks.h b/library/cpp/messagebus/local_tasks.h index 4a07bf95f5..d8e801a457 100644 --- a/library/cpp/messagebus/local_tasks.h +++ b/library/cpp/messagebus/local_tasks.h @@ -1,23 +1,23 @@ -#pragma once - +#pragma once + #include <util/system/atomic.h> -class TLocalTasks { -private: +class TLocalTasks { +private: TAtomic GotTasks; - -public: - TLocalTasks() + +public: + TLocalTasks() : GotTasks(0) { } - - void AddTask() { + + void AddTask() { AtomicSet(GotTasks, 1); - } - - bool FetchTask() { + } + + bool FetchTask() { bool gotTasks = AtomicCas(&GotTasks, 0, 1); - return gotTasks; - } -}; + return gotTasks; + } +}; |