diff options
author | mvel <mvel@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
commit | 43f5a35593ebc9f6bcea619bb170394ea7ae468e (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /util/thread | |
parent | bd30392c4cc92487950adc375c07adf52da1d592 (diff) | |
download | ydb-43f5a35593ebc9f6bcea619bb170394ea7ae468e.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/thread')
-rw-r--r-- | util/thread/lfqueue_ut.cpp | 12 | ||||
-rw-r--r-- | util/thread/pool.h | 2 | ||||
-rw-r--r-- | util/thread/pool_ut.cpp | 62 |
3 files changed, 38 insertions, 38 deletions
diff --git a/util/thread/lfqueue_ut.cpp b/util/thread/lfqueue_ut.cpp index d266848f22..83bca100cf 100644 --- a/util/thread/lfqueue_ut.cpp +++ b/util/thread/lfqueue_ut.cpp @@ -2,8 +2,8 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/algorithm.h> -#include <util/generic/vector.h> -#include <util/generic/ptr.h> +#include <util/generic/vector.h> +#include <util/generic/ptr.h> #include <util/system/atomic.h> #include <util/thread/pool.h> @@ -124,10 +124,10 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueTests) { Y_UNIT_TEST(TestSimpleEnqueueDequeue) { TLockFreeQueue<int> queue; - int i = -1; + int i = -1; UNIT_ASSERT(!queue.Dequeue(&i)); - UNIT_ASSERT_VALUES_EQUAL(i, -1); + UNIT_ASSERT_VALUES_EQUAL(i, -1); queue.Enqueue(10); queue.Enqueue(11); @@ -156,10 +156,10 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueTests) { Y_UNIT_TEST(TestSimpleEnqueueAllDequeue) { TLockFreeQueue<int> queue; - int i = -1; + int i = -1; UNIT_ASSERT(!queue.Dequeue(&i)); - UNIT_ASSERT_VALUES_EQUAL(i, -1); + UNIT_ASSERT_VALUES_EQUAL(i, -1); TVector<int> v; v.push_back(20); diff --git a/util/thread/pool.h b/util/thread/pool.h index 364530e68b..d1ea3a67cb 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -175,7 +175,7 @@ public: bool AddAndOwn(THolder<IObjectInQueue> obj) Y_WARN_UNUSED_RESULT; virtual void Start(size_t threadCount, size_t queueSizeLimit = 0) = 0; - /** Wait for completion of all scheduled objects, and then exit */ + /** Wait for completion of all scheduled objects, and then exit */ virtual void Stop() noexcept = 0; /** Number of tasks currently in queue */ virtual size_t Size() const noexcept = 0; diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp index b273dcf3c7..893770d0c4 100644 --- a/util/thread/pool_ut.cpp +++ b/util/thread/pool_ut.cpp @@ -10,12 +10,12 @@ #include <util/system/condvar.h> struct TThreadPoolTest { - TSpinLock Lock; - long R = -1; + TSpinLock Lock; + long R = -1; struct TTask: public IObjectInQueue { TThreadPoolTest* Test = nullptr; - long Value = 0; + long Value = 0; TTask(TThreadPoolTest* test, int value) : Test(test) @@ -26,8 +26,8 @@ struct TThreadPoolTest { void Process(void*) override { THolder<TTask> This(this); - TGuard<TSpinLock> guard(Test->Lock); - Test->R ^= Value; + TGuard<TSpinLock> guard(Test->Lock); + Test->R ^= Value; } }; @@ -54,7 +54,7 @@ struct TThreadPoolTest { TReallyFastRng32 rand(17); const size_t cnt = 1000; - R = 0; + R = 0; for (size_t i = 0; i < cnt; ++i) { R ^= (long)rand.GenRand(); @@ -69,48 +69,48 @@ struct TThreadPoolTest { queue->Stop(); - UNIT_ASSERT_EQUAL(0, R); + UNIT_ASSERT_EQUAL(0, R); } -}; +}; class TFailAddQueue: public IThreadPool { -public: +public: bool Add(IObjectInQueue* /*obj*/) override Y_WARN_UNUSED_RESULT { - return false; + return false; } void Start(size_t, size_t) override { - } + } void Stop() noexcept override { } size_t Size() const noexcept override { - return 0; - } -}; - + return 0; + } +}; + Y_UNIT_TEST_SUITE(TThreadPoolTest) { Y_UNIT_TEST(TestTThreadPool) { TThreadPoolTest t; TThreadPool q; - t.TestAnyQueue(&q); - } - + t.TestAnyQueue(&q); + } + Y_UNIT_TEST(TestTThreadPoolBlocking) { TThreadPoolTest t; TThreadPool q(TThreadPool::TParams().SetBlocking(true)); - t.TestAnyQueue(&q, 100); - } - - // disabled by pg@ long time ago due to test flaps - // Tried to enable: REVIEW:78772 + t.TestAnyQueue(&q, 100); + } + + // disabled by pg@ long time ago due to test flaps + // Tried to enable: REVIEW:78772 Y_UNIT_TEST(TestTAdaptiveThreadPool) { - if (false) { + if (false) { TThreadPoolTest t; TAdaptiveThreadPool q; - t.TestAnyQueue(&q); - } + t.TestAnyQueue(&q); + } } Y_UNIT_TEST(TestAddAndOwn) { @@ -126,12 +126,12 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) { } Y_UNIT_TEST(TestAddFunc) { - TFailAddQueue queue; - bool added = queue.AddFunc( + TFailAddQueue queue; + bool added = queue.AddFunc( []() {} // Lambda, I call him 'Lambda'! ); - UNIT_ASSERT_VALUES_EQUAL(added, false); - } + UNIT_ASSERT_VALUES_EQUAL(added, false); + } Y_UNIT_TEST(TestSafeAddFuncThrows) { TFailAddQueue queue; @@ -254,4 +254,4 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) { TestEnumeratedThreadName(pool, expectedNames); } } -} +} |