diff options
author | spacelord <spacelord@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
commit | 16747e4f77455cca4932df21eb76f12cb0a97a5c (patch) | |
tree | 4dd6da4102d99d0d69dec53c1050d290a850a9f2 /util/thread/pool.cpp | |
parent | a817f5de12611ec73085eba17f8ec7740a46bdb7 (diff) | |
download | ydb-16747e4f77455cca4932df21eb76f12cb0a97a5c.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/thread/pool.cpp')
-rw-r--r-- | util/thread/pool.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index 05fad02e9b..e8420eb3c8 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -67,7 +67,7 @@ TThreadFactoryHolder::TThreadFactoryHolder() noexcept class TThreadPool::TImpl: public TIntrusiveListItem<TImpl>, public IThreadFactory::IThreadAble { using TTsr = IThreadPool::TTsr; - using TJobQueue = TFastQueue<IObjectInQueue*>; + using TJobQueue = TFastQueue<IObjectInQueue*>; using TThreadRef = THolder<IThreadFactory::IThread>; public: @@ -643,20 +643,20 @@ size_t TSimpleThreadPool::Size() const noexcept { namespace { class TOwnedObjectInQueue: public IObjectInQueue { - private: - THolder<IObjectInQueue> Owned; - - public: + private: + THolder<IObjectInQueue> Owned; + + public: TOwnedObjectInQueue(THolder<IObjectInQueue> owned) : Owned(std::move(owned)) - { - } - + { + } + void Process(void* data) override { - THolder<TOwnedObjectInQueue> self(this); - Owned->Process(data); - } - }; + THolder<TOwnedObjectInQueue> self(this); + Owned->Process(data); + } + }; } void IThreadPool::SafeAdd(IObjectInQueue* obj) { @@ -665,17 +665,17 @@ void IThreadPool::SafeAdd(IObjectInQueue* obj) { void IThreadPool::SafeAddAndOwn(THolder<IObjectInQueue> obj) { Y_ENSURE_EX(AddAndOwn(std::move(obj)), TThreadPoolException() << TStringBuf("can not add to queue and own")); -} - +} + bool IThreadPool::AddAndOwn(THolder<IObjectInQueue> obj) { auto owner = MakeHolder<TOwnedObjectInQueue>(std::move(obj)); - bool added = Add(owner.Get()); - if (added) { + bool added = Add(owner.Get()); + if (added) { Y_UNUSED(owner.Release()); - } - return added; -} - + } + return added; +} + using IThread = IThreadFactory::IThread; using IThreadAble = IThreadFactory::IThreadAble; @@ -721,7 +721,7 @@ namespace { TSystemEvent StartEvent_; }; - using TThreadImplRef = TIntrusivePtr<TThreadImpl>; + using TThreadImplRef = TIntrusivePtr<TThreadImpl>; public: inline TPoolThread(IThreadPool* parent) |