diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/threading/future/wait | |
parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
download | ydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/wait')
-rw-r--r-- | library/cpp/threading/future/wait/wait-inl.h | 26 | ||||
-rw-r--r-- | library/cpp/threading/future/wait/wait.cpp | 50 | ||||
-rw-r--r-- | library/cpp/threading/future/wait/wait.h | 28 |
3 files changed, 52 insertions, 52 deletions
diff --git a/library/cpp/threading/future/wait/wait-inl.h b/library/cpp/threading/future/wait/wait-inl.h index a80b65a933..2753d5446c 100644 --- a/library/cpp/threading/future/wait/wait-inl.h +++ b/library/cpp/threading/future/wait/wait-inl.h @@ -6,31 +6,31 @@ namespace NThreading { namespace NImpl { - template <typename TContainer> - TVector<TFuture<void>> ToVoidFutures(const TContainer& futures) { - TVector<TFuture<void>> voidFutures; - voidFutures.reserve(futures.size()); + template <typename TContainer> + TVector<TFuture<void>> ToVoidFutures(const TContainer& futures) { + TVector<TFuture<void>> voidFutures; + voidFutures.reserve(futures.size()); - for (const auto& future: futures) { - voidFutures.push_back(future.IgnoreResult()); + for (const auto& future: futures) { + voidFutures.push_back(future.IgnoreResult()); } - return voidFutures; + return voidFutures; } } template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAll(const TContainer& futures) { - return WaitAll(NImpl::ToVoidFutures(futures)); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAll(const TContainer& futures) { + return WaitAll(NImpl::ToVoidFutures(futures)); } template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitExceptionOrAll(const TContainer& futures) { - return WaitExceptionOrAll(NImpl::ToVoidFutures(futures)); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitExceptionOrAll(const TContainer& futures) { + return WaitExceptionOrAll(NImpl::ToVoidFutures(futures)); } template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAny(const TContainer& futures) { - return WaitAny(NImpl::ToVoidFutures(futures)); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAny(const TContainer& futures) { + return WaitAny(NImpl::ToVoidFutures(futures)); } } diff --git a/library/cpp/threading/future/wait/wait.cpp b/library/cpp/threading/future/wait/wait.cpp index cc33f3189c..a173833a7f 100644 --- a/library/cpp/threading/future/wait/wait.cpp +++ b/library/cpp/threading/future/wait/wait.cpp @@ -1,17 +1,17 @@ -#include "wait.h" +#include "wait.h" #include "wait_group.h" #include "wait_policy.h" namespace NThreading { - namespace { + namespace { template <class WaitPolicy> - TFuture<void> WaitGeneric(const TFuture<void>& f1) { + TFuture<void> WaitGeneric(const TFuture<void>& f1) { return f1; } template <class WaitPolicy> - TFuture<void> WaitGeneric(const TFuture<void>& f1, const TFuture<void>& f2) { + TFuture<void> WaitGeneric(const TFuture<void>& f1, const TFuture<void>& f2) { TWaitGroup<WaitPolicy> wg; wg.Add(f1).Add(f2); @@ -19,13 +19,13 @@ namespace NThreading { return std::move(wg).Finish(); } - template <class WaitPolicy> - TFuture<void> WaitGeneric(TArrayRef<const TFuture<void>> futures) { + template <class WaitPolicy> + TFuture<void> WaitGeneric(TArrayRef<const TFuture<void>> futures) { if (futures.empty()) { return MakeFuture(); } if (futures.size() == 1) { - return futures.front(); + return futures.front(); } TWaitGroup<WaitPolicy> wg; @@ -39,44 +39,44 @@ namespace NThreading { //////////////////////////////////////////////////////////////////////////////// - TFuture<void> WaitAll(const TFuture<void>& f1) { - return WaitGeneric<TWaitPolicy::TAll>(f1); + TFuture<void> WaitAll(const TFuture<void>& f1) { + return WaitGeneric<TWaitPolicy::TAll>(f1); } - TFuture<void> WaitAll(const TFuture<void>& f1, const TFuture<void>& f2) { - return WaitGeneric<TWaitPolicy::TAll>(f1, f2); + TFuture<void> WaitAll(const TFuture<void>& f1, const TFuture<void>& f2) { + return WaitGeneric<TWaitPolicy::TAll>(f1, f2); } - TFuture<void> WaitAll(TArrayRef<const TFuture<void>> futures) { - return WaitGeneric<TWaitPolicy::TAll>(futures); + TFuture<void> WaitAll(TArrayRef<const TFuture<void>> futures) { + return WaitGeneric<TWaitPolicy::TAll>(futures); } //////////////////////////////////////////////////////////////////////////////// - TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1) { - return WaitGeneric<TWaitPolicy::TExceptionOrAll>(f1); + TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1) { + return WaitGeneric<TWaitPolicy::TExceptionOrAll>(f1); } - TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1, const TFuture<void>& f2) { - return WaitGeneric<TWaitPolicy::TExceptionOrAll>(f1, f2); + TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1, const TFuture<void>& f2) { + return WaitGeneric<TWaitPolicy::TExceptionOrAll>(f1, f2); } - TFuture<void> WaitExceptionOrAll(TArrayRef<const TFuture<void>> futures) { - return WaitGeneric<TWaitPolicy::TExceptionOrAll>(futures); + TFuture<void> WaitExceptionOrAll(TArrayRef<const TFuture<void>> futures) { + return WaitGeneric<TWaitPolicy::TExceptionOrAll>(futures); } //////////////////////////////////////////////////////////////////////////////// - TFuture<void> WaitAny(const TFuture<void>& f1) { - return WaitGeneric<TWaitPolicy::TAny>(f1); + TFuture<void> WaitAny(const TFuture<void>& f1) { + return WaitGeneric<TWaitPolicy::TAny>(f1); } - TFuture<void> WaitAny(const TFuture<void>& f1, const TFuture<void>& f2) { - return WaitGeneric<TWaitPolicy::TAny>(f1, f2); + TFuture<void> WaitAny(const TFuture<void>& f1, const TFuture<void>& f2) { + return WaitGeneric<TWaitPolicy::TAny>(f1, f2); } - TFuture<void> WaitAny(TArrayRef<const TFuture<void>> futures) { - return WaitGeneric<TWaitPolicy::TAny>(futures); + TFuture<void> WaitAny(TArrayRef<const TFuture<void>> futures) { + return WaitGeneric<TWaitPolicy::TAny>(futures); } } diff --git a/library/cpp/threading/future/wait/wait.h b/library/cpp/threading/future/wait/wait.h index ade4c9a3ad..6ff7d57baa 100644 --- a/library/cpp/threading/future/wait/wait.h +++ b/library/cpp/threading/future/wait/wait.h @@ -5,35 +5,35 @@ #include <library/cpp/threading/future/core/future.h> #include <library/cpp/threading/future/wait/wait_group.h> -#include <util/generic/array_ref.h> - +#include <util/generic/array_ref.h> + namespace NThreading { - namespace NImpl { - template <class TContainer> - using EnableGenericWait = std::enable_if_t< - !std::is_convertible_v<TContainer, TArrayRef<const TFuture<void>>>, - TFuture<void>>; - } + namespace NImpl { + template <class TContainer> + using EnableGenericWait = std::enable_if_t< + !std::is_convertible_v<TContainer, TArrayRef<const TFuture<void>>>, + TFuture<void>>; + } // waits for all futures [[nodiscard]] TFuture<void> WaitAll(const TFuture<void>& f1); [[nodiscard]] TFuture<void> WaitAll(const TFuture<void>& f1, const TFuture<void>& f2); - [[nodiscard]] TFuture<void> WaitAll(TArrayRef<const TFuture<void>> futures); + [[nodiscard]] TFuture<void> WaitAll(TArrayRef<const TFuture<void>> futures); template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAll(const TContainer& futures); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAll(const TContainer& futures); // waits for the first exception or for all futures [[nodiscard]] TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1); [[nodiscard]] TFuture<void> WaitExceptionOrAll(const TFuture<void>& f1, const TFuture<void>& f2); - [[nodiscard]] TFuture<void> WaitExceptionOrAll(TArrayRef<const TFuture<void>> futures); + [[nodiscard]] TFuture<void> WaitExceptionOrAll(TArrayRef<const TFuture<void>> futures); template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitExceptionOrAll(const TContainer& futures); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitExceptionOrAll(const TContainer& futures); // waits for any future [[nodiscard]] TFuture<void> WaitAny(const TFuture<void>& f1); [[nodiscard]] TFuture<void> WaitAny(const TFuture<void>& f1, const TFuture<void>& f2); - [[nodiscard]] TFuture<void> WaitAny(TArrayRef<const TFuture<void>> futures); + [[nodiscard]] TFuture<void> WaitAny(TArrayRef<const TFuture<void>> futures); template <typename TContainer> - [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAny(const TContainer& futures); + [[nodiscard]] NImpl::EnableGenericWait<TContainer> WaitAny(const TContainer& futures); } #define INCLUDE_FUTURE_INL_H |