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 /util/thread/factory_ut.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/thread/factory_ut.cpp')
-rw-r--r-- | util/thread/factory_ut.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/util/thread/factory_ut.cpp b/util/thread/factory_ut.cpp index 647d96c901..f506ce7e06 100644 --- a/util/thread/factory_ut.cpp +++ b/util/thread/factory_ut.cpp @@ -1,57 +1,57 @@ #include "factory.h" #include "pool.h" - + #include <library/cpp/testing/unittest/registar.h> - -class TThrPoolTest: public TTestBase { - UNIT_TEST_SUITE(TThrPoolTest); - UNIT_TEST(TestSystemPool) - UNIT_TEST(TestAdaptivePool) - UNIT_TEST_SUITE_END(); - + +class TThrPoolTest: public TTestBase { + UNIT_TEST_SUITE(TThrPoolTest); + UNIT_TEST(TestSystemPool) + UNIT_TEST(TestAdaptivePool) + UNIT_TEST_SUITE_END(); + struct TRunAble: public IThreadFactory::IThreadAble { - inline TRunAble() - : done(false) - { - } - + inline TRunAble() + : done(false) + { + } + ~TRunAble() override = default; - + void DoExecute() override { - done = true; - } - - bool done; - }; - -private: - inline void TestSystemPool() { - TRunAble r; - - { + done = true; + } + + bool done; + }; + +private: + inline void TestSystemPool() { + TRunAble r; + + { THolder<IThreadFactory::IThread> thr = SystemThreadFactory()->Run(&r); - - thr->Join(); - } - - UNIT_ASSERT_EQUAL(r.done, true); - } - - inline void TestAdaptivePool() { - TRunAble r; - - { + + thr->Join(); + } + + UNIT_ASSERT_EQUAL(r.done, true); + } + + inline void TestAdaptivePool() { + TRunAble r; + + { TAdaptiveThreadPool pool; - - pool.Start(0); - + + pool.Start(0); + THolder<IThreadFactory::IThread> thr = pool.Run(&r); - - thr->Join(); - } - - UNIT_ASSERT_EQUAL(r.done, true); - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TThrPoolTest); + + thr->Join(); + } + + UNIT_ASSERT_EQUAL(r.done, true); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TThrPoolTest); |