diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/messagebus/misc/granup.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/misc/granup.h')
-rw-r--r-- | library/cpp/messagebus/misc/granup.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/messagebus/misc/granup.h b/library/cpp/messagebus/misc/granup.h index 36ecfebc93..ff6cf522b4 100644 --- a/library/cpp/messagebus/misc/granup.h +++ b/library/cpp/messagebus/misc/granup.h @@ -12,29 +12,29 @@ namespace NBus { TGranUp(TDuration gran) : Gran(gran) , Next(TInstant::MicroSeconds(0)) - { - } + { + } - template <typename TFunctor> - void Update(TFunctor functor, TInstant now, bool force = false) { - if (force || now > Next) + template <typename TFunctor> + void Update(TFunctor functor, TInstant now, bool force = false) { + if (force || now > Next) Set(functor(), now); } - void Update(const TItem& item, TInstant now, bool force = false) { - if (force || now > Next) + void Update(const TItem& item, TInstant now, bool force = false) { + if (force || now > Next) Set(item, now); } - TItem Get() const noexcept { - TGuard<TLocker> guard(Lock); + TItem Get() const noexcept { + TGuard<TLocker> guard(Lock); return Item; } protected: - void Set(const TItem& item, TInstant now) { - TGuard<TLocker> guard(Lock); + void Set(const TItem& item, TInstant now) { + TGuard<TLocker> guard(Lock); Item = item; @@ -43,8 +43,8 @@ namespace NBus { private: const TDuration Gran; - TLocker Lock; - TItem Item; - TInstant Next; + TLocker Lock; + TItem Item; + TInstant Next; }; } |