aboutsummaryrefslogtreecommitdiffstats
path: root/util/thread
diff options
context:
space:
mode:
authoreeight <eeight@yandex-team.ru>2022-02-10 16:46:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:19 +0300
commitbd085aee9b4f7a0bee302ce687964ffb7098f986 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/thread
parent475c0a46f28166e83fd263badc7546377cddcabe (diff)
downloadydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/thread')
-rw-r--r--util/thread/factory.cpp26
-rw-r--r--util/thread/factory.h12
-rw-r--r--util/thread/factory_ut.cpp8
-rw-r--r--util/thread/fwd.h16
-rw-r--r--util/thread/pool.cpp78
-rw-r--r--util/thread/pool.h66
-rw-r--r--util/thread/pool_ut.cpp40
-rw-r--r--util/thread/ut/ya.make12
8 files changed, 129 insertions, 129 deletions
diff --git a/util/thread/factory.cpp b/util/thread/factory.cpp
index afe2d20760..48e898f32d 100644
--- a/util/thread/factory.cpp
+++ b/util/thread/factory.cpp
@@ -1,12 +1,12 @@
-#include "factory.h"
+#include "factory.h"
#include <util/system/thread.h>
#include <util/generic/singleton.h>
-using IThread = IThreadFactory::IThread;
+using IThread = IThreadFactory::IThread;
namespace {
- class TSystemThreadFactory: public IThreadFactory {
+ class TSystemThreadFactory: public IThreadFactory {
public:
class TPoolThread: public IThread {
public:
@@ -42,7 +42,7 @@ namespace {
THolder<TThread> Thr_;
};
- inline TSystemThreadFactory() noexcept {
+ inline TSystemThreadFactory() noexcept {
}
IThread* DoCreate() override {
@@ -50,14 +50,14 @@ namespace {
}
};
- class TThreadFactoryFuncObj: public IThreadFactory::IThreadAble {
+ class TThreadFactoryFuncObj: public IThreadFactory::IThreadAble {
public:
- TThreadFactoryFuncObj(const std::function<void()>& func)
+ TThreadFactoryFuncObj(const std::function<void()>& func)
: Func(func)
{
}
void DoExecute() override {
- THolder<TThreadFactoryFuncObj> self(this);
+ THolder<TThreadFactoryFuncObj> self(this);
Func();
}
@@ -69,18 +69,18 @@ namespace {
THolder<IThread> IThreadFactory::Run(std::function<void()> func) {
THolder<IThread> ret(DoCreate());
- ret->Run(new ::TThreadFactoryFuncObj(func));
+ ret->Run(new ::TThreadFactoryFuncObj(func));
return ret;
}
-static IThreadFactory* SystemThreadPoolImpl() {
- return Singleton<TSystemThreadFactory>();
+static IThreadFactory* SystemThreadPoolImpl() {
+ return Singleton<TSystemThreadFactory>();
}
-static IThreadFactory* systemPool = nullptr;
+static IThreadFactory* systemPool = nullptr;
-IThreadFactory* SystemThreadFactory() {
+IThreadFactory* SystemThreadFactory() {
if (systemPool) {
return systemPool;
}
@@ -88,6 +88,6 @@ IThreadFactory* SystemThreadFactory() {
return SystemThreadPoolImpl();
}
-void SetSystemThreadFactory(IThreadFactory* pool) {
+void SetSystemThreadFactory(IThreadFactory* pool) {
systemPool = pool;
}
diff --git a/util/thread/factory.h b/util/thread/factory.h
index f60a8ba56d..561fcbac88 100644
--- a/util/thread/factory.h
+++ b/util/thread/factory.h
@@ -3,7 +3,7 @@
#include <util/generic/ptr.h>
#include <functional>
-class IThreadFactory {
+class IThreadFactory {
public:
class IThreadAble {
public:
@@ -20,7 +20,7 @@ public:
};
class IThread {
- friend class IThreadFactory;
+ friend class IThreadFactory;
public:
inline IThread() noexcept = default;
@@ -42,9 +42,9 @@ public:
virtual void DoJoin() noexcept = 0;
};
- inline IThreadFactory() noexcept = default;
+ inline IThreadFactory() noexcept = default;
- virtual ~IThreadFactory() = default;
+ virtual ~IThreadFactory() = default;
// XXX: rename to Start
inline THolder<IThread> Run(IThreadAble* func) {
@@ -61,5 +61,5 @@ private:
virtual IThread* DoCreate() = 0;
};
-IThreadFactory* SystemThreadFactory();
-void SetSystemThreadFactory(IThreadFactory* pool);
+IThreadFactory* SystemThreadFactory();
+void SetSystemThreadFactory(IThreadFactory* pool);
diff --git a/util/thread/factory_ut.cpp b/util/thread/factory_ut.cpp
index d366467787..647d96c901 100644
--- a/util/thread/factory_ut.cpp
+++ b/util/thread/factory_ut.cpp
@@ -1,5 +1,5 @@
-#include "factory.h"
-#include "pool.h"
+#include "factory.h"
+#include "pool.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -9,7 +9,7 @@ class TThrPoolTest: public TTestBase {
UNIT_TEST(TestAdaptivePool)
UNIT_TEST_SUITE_END();
- struct TRunAble: public IThreadFactory::IThreadAble {
+ struct TRunAble: public IThreadFactory::IThreadAble {
inline TRunAble()
: done(false)
{
@@ -41,7 +41,7 @@ private:
TRunAble r;
{
- TAdaptiveThreadPool pool;
+ TAdaptiveThreadPool pool;
pool.Start(0);
diff --git a/util/thread/fwd.h b/util/thread/fwd.h
index f55d566b62..6f1caed21c 100644
--- a/util/thread/fwd.h
+++ b/util/thread/fwd.h
@@ -13,18 +13,18 @@ class TAutoLockFreeQueue;
template <class T>
class TLockFreeStack;
-class IThreadFactory;
+class IThreadFactory;
struct IObjectInQueue;
-class TThreadFactoryHolder;
+class TThreadFactoryHolder;
using TThreadFunction = std::function<void()>;
-class IThreadPool;
-class TFakeThreadPool;
-class TThreadPool;
-class TAdaptiveThreadPool;
-class TSimpleThreadPool;
+class IThreadPool;
+class TFakeThreadPool;
+class TThreadPool;
+class TAdaptiveThreadPool;
+class TSimpleThreadPool;
template <class TQueueType, class TSlave>
-class TThreadPoolBinder;
+class TThreadPoolBinder;
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp
index 3564449f74..05fad02e9b 100644
--- a/util/thread/pool.cpp
+++ b/util/thread/pool.cpp
@@ -24,8 +24,8 @@
#include <util/datetime/base.h>
-#include "factory.h"
-#include "pool.h"
+#include "factory.h"
+#include "pool.h"
namespace {
class TThreadNamer {
@@ -60,13 +60,13 @@ namespace {
};
}
-TThreadFactoryHolder::TThreadFactoryHolder() noexcept
- : Pool_(SystemThreadFactory())
+TThreadFactoryHolder::TThreadFactoryHolder() noexcept
+ : Pool_(SystemThreadFactory())
{
}
-class TThreadPool::TImpl: public TIntrusiveListItem<TImpl>, public IThreadFactory::IThreadAble {
- using TTsr = IThreadPool::TTsr;
+class TThreadPool::TImpl: public TIntrusiveListItem<TImpl>, public IThreadFactory::IThreadAble {
+ using TTsr = IThreadPool::TTsr;
using TJobQueue = TFastQueue<IObjectInQueue*>;
using TThreadRef = THolder<IThreadFactory::IThread>;
@@ -253,7 +253,7 @@ private:
}
private:
- TThreadPool* Parent_;
+ TThreadPool* Parent_;
const bool Blocking;
const bool Catching;
TThreadNamer Namer;
@@ -315,9 +315,9 @@ private:
};
};
-TThreadPool::~TThreadPool() = default;
+TThreadPool::~TThreadPool() = default;
-size_t TThreadPool::Size() const noexcept {
+size_t TThreadPool::Size() const noexcept {
if (!Impl_.Get()) {
return 0;
}
@@ -325,7 +325,7 @@ size_t TThreadPool::Size() const noexcept {
return Impl_->Size();
}
-size_t TThreadPool::GetThreadCountExpected() const noexcept {
+size_t TThreadPool::GetThreadCountExpected() const noexcept {
if (!Impl_.Get()) {
return 0;
}
@@ -333,7 +333,7 @@ size_t TThreadPool::GetThreadCountExpected() const noexcept {
return Impl_->GetThreadCountExpected();
}
-size_t TThreadPool::GetThreadCountReal() const noexcept {
+size_t TThreadPool::GetThreadCountReal() const noexcept {
if (!Impl_.Get()) {
return 0;
}
@@ -341,7 +341,7 @@ size_t TThreadPool::GetThreadCountReal() const noexcept {
return Impl_->GetThreadCountReal();
}
-size_t TThreadPool::GetMaxQueueSize() const noexcept {
+size_t TThreadPool::GetMaxQueueSize() const noexcept {
if (!Impl_.Get()) {
return 0;
}
@@ -349,7 +349,7 @@ size_t TThreadPool::GetMaxQueueSize() const noexcept {
return Impl_->GetMaxQueueSize();
}
-bool TThreadPool::Add(IObjectInQueue* obj) {
+bool TThreadPool::Add(IObjectInQueue* obj) {
Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));
if (Impl_->NeedRestart()) {
@@ -359,19 +359,19 @@ bool TThreadPool::Add(IObjectInQueue* obj) {
return Impl_->Add(obj);
}
-void TThreadPool::Start(size_t thrnum, size_t maxque) {
+void TThreadPool::Start(size_t thrnum, size_t maxque) {
Impl_.Reset(new TImpl(this, thrnum, maxque, Params));
}
-void TThreadPool::Stop() noexcept {
+void TThreadPool::Stop() noexcept {
Impl_.Destroy();
}
static TAtomic mtp_queue_counter = 0;
-class TAdaptiveThreadPool::TImpl {
+class TAdaptiveThreadPool::TImpl {
public:
- class TThread: public IThreadFactory::IThreadAble {
+ class TThread: public IThreadFactory::IThreadAble {
public:
inline TThread(TImpl* parent)
: Impl_(parent)
@@ -533,7 +533,7 @@ private:
}
private:
- TAdaptiveThreadPool* Parent_;
+ TAdaptiveThreadPool* Parent_;
const bool Catching;
TThreadNamer Namer;
TAtomic ThrCount_;
@@ -563,9 +563,9 @@ DEFINE_THREAD_POOL_CTORS(TThreadPool)
DEFINE_THREAD_POOL_CTORS(TAdaptiveThreadPool)
DEFINE_THREAD_POOL_CTORS(TSimpleThreadPool)
-TAdaptiveThreadPool::~TAdaptiveThreadPool() = default;
+TAdaptiveThreadPool::~TAdaptiveThreadPool() = default;
-bool TAdaptiveThreadPool::Add(IObjectInQueue* obj) {
+bool TAdaptiveThreadPool::Add(IObjectInQueue* obj) {
Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));
Impl_->Add(obj);
@@ -573,15 +573,15 @@ bool TAdaptiveThreadPool::Add(IObjectInQueue* obj) {
return true;
}
-void TAdaptiveThreadPool::Start(size_t, size_t) {
+void TAdaptiveThreadPool::Start(size_t, size_t) {
Impl_.Reset(new TImpl(this, Params));
}
-void TAdaptiveThreadPool::Stop() noexcept {
+void TAdaptiveThreadPool::Stop() noexcept {
Impl_.Destroy();
}
-size_t TAdaptiveThreadPool::Size() const noexcept {
+size_t TAdaptiveThreadPool::Size() const noexcept {
if (Impl_.Get()) {
return Impl_->Size();
}
@@ -589,13 +589,13 @@ size_t TAdaptiveThreadPool::Size() const noexcept {
return 0;
}
-void TAdaptiveThreadPool::SetMaxIdleTime(TDuration interval) {
+void TAdaptiveThreadPool::SetMaxIdleTime(TDuration interval) {
Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));
Impl_->SetMaxIdleTime(interval);
}
-TSimpleThreadPool::~TSimpleThreadPool() {
+TSimpleThreadPool::~TSimpleThreadPool() {
try {
Stop();
} catch (...) {
@@ -603,15 +603,15 @@ TSimpleThreadPool::~TSimpleThreadPool() {
}
}
-bool TSimpleThreadPool::Add(IObjectInQueue* obj) {
+bool TSimpleThreadPool::Add(IObjectInQueue* obj) {
Y_ENSURE_EX(Slave_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));
return Slave_->Add(obj);
}
-void TSimpleThreadPool::Start(size_t thrnum, size_t maxque) {
- THolder<IThreadPool> tmp;
- TAdaptiveThreadPool* adaptive(nullptr);
+void TSimpleThreadPool::Start(size_t thrnum, size_t maxque) {
+ THolder<IThreadPool> tmp;
+ TAdaptiveThreadPool* adaptive(nullptr);
if (thrnum) {
tmp.Reset(new TThreadPoolBinder<TThreadPool, TSimpleThreadPool>(this, Params));
@@ -629,11 +629,11 @@ void TSimpleThreadPool::Start(size_t thrnum, size_t maxque) {
Slave_.Swap(tmp);
}
-void TSimpleThreadPool::Stop() noexcept {
+void TSimpleThreadPool::Stop() noexcept {
Slave_.Destroy();
}
-size_t TSimpleThreadPool::Size() const noexcept {
+size_t TSimpleThreadPool::Size() const noexcept {
if (Slave_.Get()) {
return Slave_->Size();
}
@@ -659,7 +659,7 @@ namespace {
};
}
-void IThreadPool::SafeAdd(IObjectInQueue* obj) {
+void IThreadPool::SafeAdd(IObjectInQueue* obj) {
Y_ENSURE_EX(Add(obj), TThreadPoolException() << TStringBuf("can not add object to queue"));
}
@@ -676,8 +676,8 @@ bool IThreadPool::AddAndOwn(THolder<IObjectInQueue> obj) {
return added;
}
-using IThread = IThreadFactory::IThread;
-using IThreadAble = IThreadFactory::IThreadAble;
+using IThread = IThreadFactory::IThread;
+using IThreadAble = IThreadFactory::IThreadAble;
namespace {
class TPoolThread: public IThread {
@@ -724,7 +724,7 @@ namespace {
using TThreadImplRef = TIntrusivePtr<TThreadImpl>;
public:
- inline TPoolThread(IThreadPool* parent)
+ inline TPoolThread(IThreadPool* parent)
: Parent_(parent)
{
}
@@ -751,21 +751,21 @@ namespace {
}
private:
- IThreadPool* Parent_;
+ IThreadPool* Parent_;
TThreadImplRef Impl_;
};
}
-IThread* IThreadPool::DoCreate() {
+IThread* IThreadPool::DoCreate() {
return new TPoolThread(this);
}
THolder<IThreadPool> CreateThreadPool(size_t threadsCount, size_t queueSizeLimit, const TThreadPoolParams& params) {
- THolder<IThreadPool> queue;
+ THolder<IThreadPool> queue;
if (threadsCount > 1) {
queue.Reset(new TThreadPool(params));
} else {
- queue.Reset(new TFakeThreadPool());
+ queue.Reset(new TFakeThreadPool());
}
queue->Start(threadsCount, queueSizeLimit);
return queue;
diff --git a/util/thread/pool.h b/util/thread/pool.h
index 9876cfc0c0..d1ea3a67cb 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -1,7 +1,7 @@
#pragma once
#include "fwd.h"
-#include "factory.h"
+#include "factory.h"
#include <util/system/yassert.h>
#include <util/system/defaults.h>
@@ -20,8 +20,8 @@ struct IObjectInQueue {
* in multiple threads.
*
* @param threadSpecificResource is nullptr by default. But if you override
- * IThreadPool::CreateThreadSpecificResource, then result of
- * IThreadPool::CreateThreadSpecificResource is passed as threadSpecificResource
+ * IThreadPool::CreateThreadSpecificResource, then result of
+ * IThreadPool::CreateThreadSpecificResource is passed as threadSpecificResource
* parameter.
*/
virtual void Process(void* threadSpecificResource) = 0;
@@ -31,26 +31,26 @@ struct IObjectInQueue {
* Mighty class to add 'Pool' method to derived classes.
* Useful only for creators of new queue classes.
*/
-class TThreadFactoryHolder {
+class TThreadFactoryHolder {
public:
- TThreadFactoryHolder() noexcept;
+ TThreadFactoryHolder() noexcept;
- inline TThreadFactoryHolder(IThreadFactory* pool) noexcept
+ inline TThreadFactoryHolder(IThreadFactory* pool) noexcept
: Pool_(pool)
{
}
- inline ~TThreadFactoryHolder() = default;
+ inline ~TThreadFactoryHolder() = default;
- inline IThreadFactory* Pool() const noexcept {
+ inline IThreadFactory* Pool() const noexcept {
return Pool_;
}
private:
- IThreadFactory* Pool_;
+ IThreadFactory* Pool_;
};
-class TThreadPoolException: public yexception {
+class TThreadPoolException: public yexception {
};
template <class T>
@@ -136,11 +136,11 @@ struct TThreadPoolParams {
/**
* A queue processed simultaneously by several threads
*/
-class IThreadPool: public IThreadFactory, public TNonCopyable {
+class IThreadPool: public IThreadFactory, public TNonCopyable {
public:
using TParams = TThreadPoolParams;
- ~IThreadPool() override = default;
+ ~IThreadPool() override = default;
/**
* Safe versions of Add*() functions. Behave exactly like as non-safe
@@ -183,11 +183,11 @@ public:
public:
/**
* RAII wrapper for Create/DestroyThreadSpecificResource.
- * Useful only for implementers of new IThreadPool queues.
+ * Useful only for implementers of new IThreadPool queues.
*/
class TTsr {
public:
- inline TTsr(IThreadPool* q)
+ inline TTsr(IThreadPool* q)
: Q_(q)
, Data_(Q_->CreateThreadSpecificResource())
{
@@ -206,14 +206,14 @@ public:
}
private:
- IThreadPool* Q_;
+ IThreadPool* Q_;
void* Data_;
};
/**
* CreateThreadSpecificResource and DestroyThreadSpecificResource
- * called from internals of (TAdaptiveThreadPool, TThreadPool, ...) implementation,
- * not by user of IThreadPool interface.
+ * called from internals of (TAdaptiveThreadPool, TThreadPool, ...) implementation,
+ * not by user of IThreadPool interface.
* Created resource is passed to IObjectInQueue::Proccess function.
*/
virtual void* CreateThreadSpecificResource() {
@@ -231,11 +231,11 @@ private:
};
/**
- * Single-threaded implementation of IThreadPool, process tasks in same thread when
+ * Single-threaded implementation of IThreadPool, process tasks in same thread when
* added.
* Can be used to remove multithreading.
*/
-class TFakeThreadPool: public IThreadPool {
+class TFakeThreadPool: public IThreadPool {
public:
bool Add(IObjectInQueue* pObj) override Y_WARN_UNUSED_RESULT {
TTsr tsr(this);
@@ -267,7 +267,7 @@ protected:
class TThreadPool: public TThreadPoolBase {
public:
TThreadPool(const TParams& params = {});
- ~TThreadPool() override;
+ ~TThreadPool() override;
bool Add(IObjectInQueue* obj) override Y_WARN_UNUSED_RESULT;
/**
@@ -293,7 +293,7 @@ private:
class TAdaptiveThreadPool: public TThreadPoolBase {
public:
TAdaptiveThreadPool(const TParams& params = {});
- ~TAdaptiveThreadPool() override;
+ ~TAdaptiveThreadPool() override;
/**
* If working thread waits task too long (more then interval parameter),
@@ -313,34 +313,34 @@ private:
THolder<TImpl> Impl_;
};
-/** Behave like TThreadPool or TAdaptiveThreadPool, choosen by thrnum parameter of Start() */
+/** Behave like TThreadPool or TAdaptiveThreadPool, choosen by thrnum parameter of Start() */
class TSimpleThreadPool: public TThreadPoolBase {
public:
TSimpleThreadPool(const TParams& params = {});
- ~TSimpleThreadPool() override;
+ ~TSimpleThreadPool() override;
bool Add(IObjectInQueue* obj) override Y_WARN_UNUSED_RESULT;
/**
- * @parameter thrnum. If thrnum is 0, use TAdaptiveThreadPool with small
- * SetMaxIdleTime interval parameter. if thrnum is not 0, use non-blocking TThreadPool
+ * @parameter thrnum. If thrnum is 0, use TAdaptiveThreadPool with small
+ * SetMaxIdleTime interval parameter. if thrnum is not 0, use non-blocking TThreadPool
*/
void Start(size_t thrnum, size_t maxque = 0) override;
void Stop() noexcept override;
size_t Size() const noexcept override;
private:
- THolder<IThreadPool> Slave_;
+ THolder<IThreadPool> Slave_;
};
/**
* Helper to override virtual functions Create/DestroyThreadSpecificResource
- * from IThreadPool and implement them using functions with same name from
+ * from IThreadPool and implement them using functions with same name from
* pointer to TSlave.
*/
template <class TQueueType, class TSlave>
-class TThreadPoolBinder: public TQueueType {
+class TThreadPoolBinder: public TQueueType {
public:
- inline TThreadPoolBinder(TSlave* slave)
+ inline TThreadPoolBinder(TSlave* slave)
: Slave_(slave)
{
}
@@ -352,12 +352,12 @@ public:
{
}
- inline TThreadPoolBinder(TSlave& slave)
+ inline TThreadPoolBinder(TSlave& slave)
: Slave_(&slave)
{
}
- ~TThreadPoolBinder() override {
+ ~TThreadPoolBinder() override {
try {
this->Stop();
} catch (...) {
@@ -384,7 +384,7 @@ inline void Delete(THolder<IThreadPool> q) {
}
/**
- * Creates and starts TThreadPool if threadsCount > 1, or TFakeThreadPool otherwise
- * You could specify blocking and catching modes for TThreadPool only
+ * Creates and starts TThreadPool if threadsCount > 1, or TFakeThreadPool otherwise
+ * You could specify blocking and catching modes for TThreadPool only
*/
THolder<IThreadPool> CreateThreadPool(size_t threadCount, size_t queueSizeLimit = 0, const IThreadPool::TParams& params = {});
diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp
index f11851ead3..893770d0c4 100644
--- a/util/thread/pool_ut.cpp
+++ b/util/thread/pool_ut.cpp
@@ -1,4 +1,4 @@
-#include "pool.h"
+#include "pool.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -9,15 +9,15 @@
#include <util/system/mutex.h>
#include <util/system/condvar.h>
-struct TThreadPoolTest {
+struct TThreadPoolTest {
TSpinLock Lock;
long R = -1;
struct TTask: public IObjectInQueue {
- TThreadPoolTest* Test = nullptr;
+ TThreadPoolTest* Test = nullptr;
long Value = 0;
- TTask(TThreadPoolTest* test, int value)
+ TTask(TThreadPoolTest* test, int value)
: Test(test)
, Value(value)
{
@@ -50,7 +50,7 @@ struct TThreadPoolTest {
}
};
- inline void TestAnyQueue(IThreadPool* queue, size_t queueSize = 1000) {
+ inline void TestAnyQueue(IThreadPool* queue, size_t queueSize = 1000) {
TReallyFastRng32 rand(17);
const size_t cnt = 1000;
@@ -73,7 +73,7 @@ struct TThreadPoolTest {
}
};
-class TFailAddQueue: public IThreadPool {
+class TFailAddQueue: public IThreadPool {
public:
bool Add(IObjectInQueue* /*obj*/) override Y_WARN_UNUSED_RESULT {
return false;
@@ -90,35 +90,35 @@ public:
}
};
-Y_UNIT_TEST_SUITE(TThreadPoolTest) {
- Y_UNIT_TEST(TestTThreadPool) {
- TThreadPoolTest t;
- TThreadPool q;
+Y_UNIT_TEST_SUITE(TThreadPoolTest) {
+ Y_UNIT_TEST(TestTThreadPool) {
+ TThreadPoolTest t;
+ TThreadPool q;
t.TestAnyQueue(&q);
}
- Y_UNIT_TEST(TestTThreadPoolBlocking) {
- TThreadPoolTest t;
+ 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
- Y_UNIT_TEST(TestTAdaptiveThreadPool) {
+ Y_UNIT_TEST(TestTAdaptiveThreadPool) {
if (false) {
- TThreadPoolTest t;
- TAdaptiveThreadPool q;
+ TThreadPoolTest t;
+ TAdaptiveThreadPool q;
t.TestAnyQueue(&q);
}
}
Y_UNIT_TEST(TestAddAndOwn) {
- TThreadPool q;
+ TThreadPool q;
q.Start(2);
bool processed = false;
bool destructed = false;
- q.SafeAddAndOwn(MakeHolder<TThreadPoolTest::TOwnedTask>(processed, destructed));
+ q.SafeAddAndOwn(MakeHolder<TThreadPoolTest::TOwnedTask>(processed, destructed));
q.Stop();
UNIT_ASSERT_C(processed, "Not processed");
@@ -135,7 +135,7 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) {
Y_UNIT_TEST(TestSafeAddFuncThrows) {
TFailAddQueue queue;
- UNIT_CHECK_GENERATED_EXCEPTION(queue.SafeAddFunc([] {}), TThreadPoolException);
+ UNIT_CHECK_GENERATED_EXCEPTION(queue.SafeAddFunc([] {}), TThreadPoolException);
}
Y_UNIT_TEST(TestFunctionNotCopied) {
@@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) {
}
TFailOnCopy(const TFailOnCopy&) {
- UNIT_FAIL("Don't copy std::function inside TThreadPool");
+ UNIT_FAIL("Don't copy std::function inside TThreadPool");
}
};
@@ -160,7 +160,7 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) {
}
Y_UNIT_TEST(TestInfoGetters) {
- TThreadPool queue;
+ TThreadPool queue;
queue.Start(2, 7);
diff --git a/util/thread/ut/ya.make b/util/thread/ut/ya.make
index af50ab2452..93198bfaf1 100644
--- a/util/thread/ut/ya.make
+++ b/util/thread/ut/ya.make
@@ -4,15 +4,15 @@ OWNER(g:util)
SUBSCRIBER(g:util-subscribers)
SRCS(
- thread/factory_ut.cpp
+ thread/factory_ut.cpp
thread/lfqueue_ut.cpp
thread/lfstack_ut.cpp
- thread/pool_ut.cpp
+ thread/pool_ut.cpp
thread/singleton_ut.cpp
)
-PEERDIR(
- library/cpp/threading/future
-)
-
+PEERDIR(
+ library/cpp/threading/future
+)
+
END()