aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/future/async_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/threading/future/async_ut.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/async_ut.cpp')
-rw-r--r--library/cpp/threading/future/async_ut.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/library/cpp/threading/future/async_ut.cpp b/library/cpp/threading/future/async_ut.cpp
index a452965dbc..a3699744e4 100644
--- a/library/cpp/threading/future/async_ut.cpp
+++ b/library/cpp/threading/future/async_ut.cpp
@@ -6,13 +6,13 @@
#include <util/generic/vector.h>
namespace {
- struct TMySuperTaskQueue {
- };
+ struct TMySuperTaskQueue {
+ };
}
namespace NThreading {
- /* Here we provide an Async overload for TMySuperTaskQueue indide NThreading namespace
+ /* Here we provide an Async overload for TMySuperTaskQueue indide NThreading namespace
* so that we can call it in the way
*
* TMySuperTaskQueue queue;
@@ -20,38 +20,38 @@ namespace NThreading {
*
* See also ExtensionExample unittest.
*/
- template <typename Func>
- TFuture<TFunctionResult<Func>> Async(Func func, TMySuperTaskQueue&) {
- return MakeFuture(func());
- }
+ template <typename Func>
+ TFuture<TFunctionResult<Func>> Async(Func func, TMySuperTaskQueue&) {
+ return MakeFuture(func());
+ }
}
Y_UNIT_TEST_SUITE(Async) {
Y_UNIT_TEST(ExtensionExample) {
- TMySuperTaskQueue queue;
- auto future = NThreading::Async([]() { return 5; }, queue);
- future.Wait();
- UNIT_ASSERT_VALUES_EQUAL(future.GetValue(), 5);
- }
+ TMySuperTaskQueue queue;
+ auto future = NThreading::Async([]() { return 5; }, queue);
+ future.Wait();
+ UNIT_ASSERT_VALUES_EQUAL(future.GetValue(), 5);
+ }
Y_UNIT_TEST(WorksWithIMtpQueue) {
auto queue = MakeHolder<TThreadPool>();
- queue->Start(1);
+ queue->Start(1);
- auto future = NThreading::Async([]() { return 5; }, *queue);
- future.Wait();
- UNIT_ASSERT_VALUES_EQUAL(future.GetValue(), 5);
- }
+ auto future = NThreading::Async([]() { return 5; }, *queue);
+ future.Wait();
+ UNIT_ASSERT_VALUES_EQUAL(future.GetValue(), 5);
+ }
Y_UNIT_TEST(ProperlyDeducesFutureType) {
- // Compileability test
+ // Compileability test
auto queue = CreateThreadPool(1);
- NThreading::TFuture<void> f1 = NThreading::Async([]() {}, *queue);
- NThreading::TFuture<int> f2 = NThreading::Async([]() { return 5; }, *queue);
- NThreading::TFuture<double> f3 = NThreading::Async([]() { return 5.0; }, *queue);
- NThreading::TFuture<TVector<int>> f4 = NThreading::Async([]() { return TVector<int>(); }, *queue);
- NThreading::TFuture<int> f5 = NThreading::Async([]() { return NThreading::MakeFuture(5); }, *queue);
- }
+ NThreading::TFuture<void> f1 = NThreading::Async([]() {}, *queue);
+ NThreading::TFuture<int> f2 = NThreading::Async([]() { return 5; }, *queue);
+ NThreading::TFuture<double> f3 = NThreading::Async([]() { return 5.0; }, *queue);
+ NThreading::TFuture<TVector<int>> f4 = NThreading::Async([]() { return TVector<int>(); }, *queue);
+ NThreading::TFuture<int> f5 = NThreading::Async([]() { return NThreading::MakeFuture(5); }, *queue);
+ }
}