diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
commit | 475c0a46f28166e83fd263badc7546377cddcabe (patch) | |
tree | 39c5a49b8aaad78fe390b6f1f2886bdbda40f3e7 /library/cpp/actors | |
parent | a6e0145a095c7bb3770d6e07aee301de5c73f96e (diff) | |
download | ydb-475c0a46f28166e83fd263badc7546377cddcabe.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/actors')
-rw-r--r-- | library/cpp/actors/core/actor_ut.cpp | 32 | ||||
-rw-r--r-- | library/cpp/actors/core/actorid.h | 18 | ||||
-rw-r--r-- | library/cpp/actors/core/executor_pool_basic_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/core/executor_thread.cpp | 4 | ||||
-rw-r--r-- | library/cpp/actors/core/mailbox.h | 8 | ||||
-rw-r--r-- | library/cpp/actors/core/mailbox_queue_simple.h | 2 | ||||
-rw-r--r-- | library/cpp/actors/core/scheduler_basic.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/core/scheduler_cookie.cpp | 12 | ||||
-rw-r--r-- | library/cpp/actors/core/scheduler_cookie.h | 12 | ||||
-rw-r--r-- | library/cpp/actors/http/http_cache.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/memory_log/memlog.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/testlib/decorator_ut.cpp | 20 | ||||
-rw-r--r-- | library/cpp/actors/util/queue_oneone_inplace.h | 8 | ||||
-rw-r--r-- | library/cpp/actors/util/thread.h | 4 | ||||
-rw-r--r-- | library/cpp/actors/util/threadparkpad.cpp | 38 | ||||
-rw-r--r-- | library/cpp/actors/util/threadparkpad.h | 10 | ||||
-rw-r--r-- | library/cpp/actors/util/ticket_lock.h | 8 |
17 files changed, 92 insertions, 92 deletions
diff --git a/library/cpp/actors/core/actor_ut.cpp b/library/cpp/actors/core/actor_ut.cpp index e1b765ec72..2f022c2d80 100644 --- a/library/cpp/actors/core/actor_ut.cpp +++ b/library/cpp/actors/core/actor_ut.cpp @@ -188,9 +188,9 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) { TThreadParkPad pad; TAtomic actorsAlive = 0; double elapsedTime = 0; - THolder<IActor> endActor{ - new TTestEndDecorator(THolder( - new TSendReceiveActor(&elapsedTime, {}, allocation, Leader)), &pad, &actorsAlive)}; + THolder<IActor> endActor{ + new TTestEndDecorator(THolder( + new TSendReceiveActor(&elapsedTime, {}, allocation, Leader)), &pad, &actorsAlive)}; actorSystem.Register(endActor.Release(), mType); @@ -213,9 +213,9 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) { ui32 leaderPoolId = poolsCount == 1 ? 0 : 1; TActorId followerId = actorSystem.Register( new TSendReceiveActor(nullptr, {}, allocation, Follower), TMailboxType::HTSwap, followerPoolId); - THolder<IActor> leader{ - new TTestEndDecorator(THolder( - new TSendReceiveActor(&elapsedTime, followerId, allocation, Leader)), &pad, &actorsAlive)}; + THolder<IActor> leader{ + new TTestEndDecorator(THolder( + new TSendReceiveActor(&elapsedTime, followerId, allocation, Leader)), &pad, &actorsAlive)}; actorSystem.Register(leader.Release(), TMailboxType::HTSwap, leaderPoolId); pad.Park(); @@ -235,9 +235,9 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) { TActorId followerId = actorSystem.Register( new TSendReceiveActor(nullptr, {}, false, Follower, MailboxNeighbourActors), TMailboxType::HTSwap); - THolder<IActor> leader{ - new TTestEndDecorator(THolder( - new TSendReceiveActor(&elapsedTime, followerId, false, Leader, MailboxNeighbourActors)), &pad, &actorsAlive)}; + THolder<IActor> leader{ + new TTestEndDecorator(THolder( + new TSendReceiveActor(&elapsedTime, followerId, false, Leader, MailboxNeighbourActors)), &pad, &actorsAlive)}; actorSystem.Register(leader.Release(), TMailboxType::HTSwap); pad.Park(); @@ -262,9 +262,9 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) { ui32 leaderPoolId = 0; TActorId followerId = actorSystem.Register( new TSendReceiveActor(nullptr, {}, true, Follower), TMailboxType::HTSwap, followerPoolId); - THolder<IActor> leader{ - new TTestEndDecorator(THolder( - new TSendReceiveActor(&dummy[i], followerId, true, Leader)), &pad, &actorsAlive)}; + THolder<IActor> leader{ + new TTestEndDecorator(THolder( + new TSendReceiveActor(&dummy[i], followerId, true, Leader)), &pad, &actorsAlive)}; actorSystem.Register(leader.Release(), TMailboxType::HTSwap, leaderPoolId); } @@ -550,16 +550,16 @@ Y_UNIT_TEST_SUITE(TestDecorator) { TActorSystem actorSystem(setup); actorSystem.Start(); - THolder<IActor> innerActor = MakeHolder<TTestActor>(); + THolder<IActor> innerActor = MakeHolder<TTestActor>(); ui64 pongCounter = 0; - THolder<IActor> pongActor = MakeHolder<TPongDecorator>(std::move(innerActor), &pongCounter); + THolder<IActor> pongActor = MakeHolder<TPongDecorator>(std::move(innerActor), &pongCounter); ui64 pingCounter = 0; - THolder<IActor> pingActor = MakeHolder<TPingDecorator>(std::move(pongActor), &pingCounter); + THolder<IActor> pingActor = MakeHolder<TPingDecorator>(std::move(pongActor), &pingCounter); TThreadParkPad pad; TAtomic actorsAlive = 0; - THolder<IActor> endActor = MakeHolder<TTestEndDecorator>(std::move(pingActor), &pad, &actorsAlive); + THolder<IActor> endActor = MakeHolder<TTestEndDecorator>(std::move(pingActor), &pad, &actorsAlive); actorSystem.Register(endActor.Release(), TMailboxType::HTSwap); pad.Park(); diff --git a/library/cpp/actors/core/actorid.h b/library/cpp/actors/core/actorid.h index d972b1a0ff..4a57bed146 100644 --- a/library/cpp/actors/core/actorid.h +++ b/library/cpp/actors/core/actorid.h @@ -66,40 +66,40 @@ namespace NActors { return Raw.X.X1 != 0 || Raw.X.X2 != 0; } - ui64 LocalId() const noexcept { + ui64 LocalId() const noexcept { return Raw.N.LocalId; } - ui32 Hint() const noexcept { + ui32 Hint() const noexcept { return Raw.N.Hint; } - ui32 NodeId() const noexcept { + ui32 NodeId() const noexcept { return Raw.N.NodeId & NodeIdMask; } - bool IsService() const noexcept { + bool IsService() const noexcept { return (Raw.N.NodeId & ServiceMask); } - TStringBuf ServiceId() const noexcept { + TStringBuf ServiceId() const noexcept { Y_VERIFY_DEBUG(IsService()); return TStringBuf((const char*)Raw.Buf, MaxServiceIDLength); } - static ui32 PoolIndex(ui32 nodeid) noexcept { + static ui32 PoolIndex(ui32 nodeid) noexcept { return ((nodeid & PoolIndexMask) >> PoolIndexShift); } - ui32 PoolID() const noexcept { + ui32 PoolID() const noexcept { return PoolIndex(Raw.N.NodeId); } - ui64 RawX1() const noexcept { + ui64 RawX1() const noexcept { return Raw.X.X1; } - ui64 RawX2() const noexcept { + ui64 RawX2() const noexcept { return Raw.X.X2; } diff --git a/library/cpp/actors/core/executor_pool_basic_ut.cpp b/library/cpp/actors/core/executor_pool_basic_ut.cpp index 76dff693af..71dc9d3b20 100644 --- a/library/cpp/actors/core/executor_pool_basic_ut.cpp +++ b/library/cpp/actors/core/executor_pool_basic_ut.cpp @@ -82,7 +82,7 @@ THolder<TActorSystemSetup> GetActorSystemSetup(TBasicExecutorPool* pool) auto setup = MakeHolder<NActors::TActorSystemSetup>(); setup->NodeId = 1; setup->ExecutorsCount = 1; - setup->Executors.Reset(new TAutoPtr<NActors::IExecutorPool>[1]); + setup->Executors.Reset(new TAutoPtr<NActors::IExecutorPool>[1]); setup->Executors[0] = pool; setup->Scheduler = new TBasicSchedulerThread(NActors::TSchedulerConfig(512, 0)); return setup; diff --git a/library/cpp/actors/core/executor_thread.cpp b/library/cpp/actors/core/executor_thread.cpp index 446b651efd..af8965365f 100644 --- a/library/cpp/actors/core/executor_thread.cpp +++ b/library/cpp/actors/core/executor_thread.cpp @@ -64,7 +64,7 @@ namespace NActors { void TExecutorThread::UnregisterActor(TMailboxHeader* mailbox, ui64 localActorId) { IActor* actor = mailbox->DetachActor(localActorId); Ctx.DecrementActorsAliveByActivity(actor->GetActivityType()); - DyingActors.push_back(THolder(actor)); + DyingActors.push_back(THolder(actor)); } void TExecutorThread::DropUnregistered() { @@ -298,7 +298,7 @@ namespace NActors { #endif if (ThreadName) { - ::SetCurrentThreadName(ThreadName); + ::SetCurrentThreadName(ThreadName); } ExecutorPool->SetRealTimeMode(); diff --git a/library/cpp/actors/core/mailbox.h b/library/cpp/actors/core/mailbox.h index 0bd9c4d314..43a2ffdbf4 100644 --- a/library/cpp/actors/core/mailbox.h +++ b/library/cpp/actors/core/mailbox.h @@ -95,7 +95,7 @@ namespace NActors { bool UnlockFromExecution2(bool wouldReschedule); // proceed with releasing lock bool UnlockAsFree(bool wouldReschedule); // preceed with releasing lock, but mark as free one - bool IsEmpty() const noexcept { + bool IsEmpty() const noexcept { return (ActorPack == TMailboxActorPack::Simple && ActorsInfo.Simple.ActorId == 0); } @@ -123,7 +123,7 @@ namespace NActors { } } - IActor* FindActor(ui64 localActorId) noexcept { + IActor* FindActor(ui64 localActorId) noexcept { switch (ActorPack) { case TMailboxActorPack::Simple: { if (ActorsInfo.Simple.ActorId == localActorId) @@ -150,7 +150,7 @@ namespace NActors { return nullptr; } - void AttachActor(ui64 localActorId, IActor* actor) noexcept { + void AttachActor(ui64 localActorId, IActor* actor) noexcept { switch (ActorPack) { case TMailboxActorPack::Simple: { if (ActorsInfo.Simple.ActorId == 0) { @@ -192,7 +192,7 @@ namespace NActors { } } - IActor* DetachActor(ui64 localActorId) noexcept { + IActor* DetachActor(ui64 localActorId) noexcept { Y_VERIFY_DEBUG(FindActor(localActorId) != nullptr); IActor* actorToDestruct = nullptr; diff --git a/library/cpp/actors/core/mailbox_queue_simple.h b/library/cpp/actors/core/mailbox_queue_simple.h index 2e44c21adb..535c012f19 100644 --- a/library/cpp/actors/core/mailbox_queue_simple.h +++ b/library/cpp/actors/core/mailbox_queue_simple.h @@ -12,7 +12,7 @@ namespace NActors { TTicketLock Lock; public: - ui32 Push(T x) noexcept { + ui32 Push(T x) noexcept { const ui32 spins = Lock.Acquire(); Queue.Push(x); Lock.Release(); diff --git a/library/cpp/actors/core/scheduler_basic.cpp b/library/cpp/actors/core/scheduler_basic.cpp index fba200e16b..59129d568e 100644 --- a/library/cpp/actors/core/scheduler_basic.cpp +++ b/library/cpp/actors/core/scheduler_basic.cpp @@ -53,7 +53,7 @@ namespace NActors { #ifdef BALLOC ThreadDisableBalloc(); #endif - ::SetCurrentThreadName("Scheduler"); + ::SetCurrentThreadName("Scheduler"); ui64 currentMonotonic = RelaxedLoad(CurrentMonotonic); ui64 throttledMonotonic = currentMonotonic; diff --git a/library/cpp/actors/core/scheduler_cookie.cpp b/library/cpp/actors/core/scheduler_cookie.cpp index 0fa6f543a7..faee2a206a 100644 --- a/library/cpp/actors/core/scheduler_cookie.cpp +++ b/library/cpp/actors/core/scheduler_cookie.cpp @@ -10,11 +10,11 @@ namespace NActors { { } - bool IsArmed() noexcept override { + bool IsArmed() noexcept override { return (AtomicGet(Value) == 2); } - bool Detach() noexcept override { + bool Detach() noexcept override { const ui64 x = AtomicDecrement(Value); if (x == 1) return true; @@ -27,7 +27,7 @@ namespace NActors { Y_FAIL(); } - bool DetachEvent() noexcept override { + bool DetachEvent() noexcept override { Y_FAIL(); } }; @@ -45,11 +45,11 @@ namespace NActors { { } - bool IsArmed() noexcept override { + bool IsArmed() noexcept override { return (AtomicGet(Value) == 3); } - bool Detach() noexcept override { + bool Detach() noexcept override { const ui64 x = AtomicDecrement(Value); if (x == 2) return true; @@ -63,7 +63,7 @@ namespace NActors { Y_FAIL(); } - bool DetachEvent() noexcept override { + bool DetachEvent() noexcept override { const ui64 x = AtomicDecrement(Value); if (x == 2) return false; diff --git a/library/cpp/actors/core/scheduler_cookie.h b/library/cpp/actors/core/scheduler_cookie.h index 2c20ca67f3..68f7e1b94d 100644 --- a/library/cpp/actors/core/scheduler_cookie.h +++ b/library/cpp/actors/core/scheduler_cookie.h @@ -10,9 +10,9 @@ namespace NActors { } public: - virtual bool Detach() noexcept = 0; - virtual bool DetachEvent() noexcept = 0; - virtual bool IsArmed() noexcept = 0; + virtual bool Detach() noexcept = 0; + virtual bool DetachEvent() noexcept = 0; + virtual bool IsArmed() noexcept = 0; static ISchedulerCookie* Make2Way(); static ISchedulerCookie* Make3Way(); @@ -36,7 +36,7 @@ namespace NActors { Detach(); } - bool operator==(const TSchedulerCookieHolder& x) const noexcept { + bool operator==(const TSchedulerCookieHolder& x) const noexcept { return (Cookie == x.Cookie); } @@ -55,7 +55,7 @@ namespace NActors { Cookie = cookie; } - bool Detach() noexcept { + bool Detach() noexcept { if (Cookie) { const bool res = Cookie->Detach(); Cookie = nullptr; @@ -65,7 +65,7 @@ namespace NActors { } } - bool DetachEvent() noexcept { + bool DetachEvent() noexcept { if (Cookie) { const bool res = Cookie->DetachEvent(); Cookie = nullptr; diff --git a/library/cpp/actors/http/http_cache.cpp b/library/cpp/actors/http/http_cache.cpp index 27c4eeb6f3..4ea22ffaa7 100644 --- a/library/cpp/actors/http/http_cache.cpp +++ b/library/cpp/actors/http/http_cache.cpp @@ -9,7 +9,7 @@ #include <library/cpp/digest/md5/md5.h> #include <util/digest/multi.h> #include <util/generic/queue.h> -#include <util/string/cast.h> +#include <util/string/cast.h> namespace NHttp { diff --git a/library/cpp/actors/memory_log/memlog.cpp b/library/cpp/actors/memory_log/memlog.cpp index 8e6b46727d..5358e1b0f1 100644 --- a/library/cpp/actors/memory_log/memlog.cpp +++ b/library/cpp/actors/memory_log/memlog.cpp @@ -105,7 +105,7 @@ char* TMemoryLog::LastMarkIsHere = nullptr; std::atomic<bool> TMemoryLog::PrintLastMark(true); -TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) +TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) : GrainSize(grainSize) , FreeGrains(DEFAULT_TOTAL_SIZE / DEFAULT_GRAIN_SIZE * 2) , Buf(totalSize) diff --git a/library/cpp/actors/testlib/decorator_ut.cpp b/library/cpp/actors/testlib/decorator_ut.cpp index e9a2fa3560..3b297b63e6 100644 --- a/library/cpp/actors/testlib/decorator_ut.cpp +++ b/library/cpp/actors/testlib/decorator_ut.cpp @@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(TesTTestDecorator) { { Write("Start master actor"); for (auto &actor : Actors) { - THolder<IActor> decaratedActor = MakeHolder<TDyingChecker>(std::move(actor), SelfId()); + THolder<IActor> decaratedActor = MakeHolder<TDyingChecker>(std::move(actor), SelfId()); TActorId id = Register(decaratedActor.Release()); Write("Register test actor"); UNIT_ASSERT(ActorIds.insert(id).second); @@ -232,11 +232,11 @@ Y_UNIT_TEST_SUITE(TesTTestDecorator) { void Bootstrap() { Write("TFizzBuzzSender::Bootstrap"); - THolder<IActor> actor = MakeHolder<TFooBarReceiver>(SelfId()); - THolder<IActor> decoratedActor = MakeHolder<TDyingChecker>(std::move(actor), SelfId()); + THolder<IActor> actor = MakeHolder<TFooBarReceiver>(SelfId()); + THolder<IActor> decoratedActor = MakeHolder<TDyingChecker>(std::move(actor), SelfId()); SlaveId = Register(decoratedActor.Release()); for (ui64 idx = 1; idx <= 30; ++idx) { - THolder<TEvWords> ev = MakeHolder<TEvWords>(); + THolder<TEvWords> ev = MakeHolder<TEvWords>(); if (idx % 3 == 0) { ev->Words.push_back("Fizz"); } @@ -295,11 +295,11 @@ Y_UNIT_TEST_SUITE(TesTTestDecorator) { } THolder<IActor> CreateFizzBuzzSender() { - THolder<IActor> actor = MakeHolder<TFizzBuzzSender>(); - THolder<IActor> foobar = MakeHolder<TFizzBuzzToFooBar>(std::move(actor)); - THolder<IActor> fizzEraser = MakeHolder<TWordEraser>(std::move(foobar), "Fizz"); - THolder<IActor> buzzEraser = MakeHolder<TWordEraser>(std::move(fizzEraser), "Buzz"); - return MakeHolder<TWithoutWordsDroper>(std::move(buzzEraser)); + THolder<IActor> actor = MakeHolder<TFizzBuzzSender>(); + THolder<IActor> foobar = MakeHolder<TFizzBuzzToFooBar>(std::move(actor)); + THolder<IActor> fizzEraser = MakeHolder<TWordEraser>(std::move(foobar), "Fizz"); + THolder<IActor> buzzEraser = MakeHolder<TWordEraser>(std::move(fizzEraser), "Buzz"); + return MakeHolder<TWithoutWordsDroper>(std::move(buzzEraser)); } Y_UNIT_TEST(Basic) { @@ -315,7 +315,7 @@ Y_UNIT_TEST_SUITE(TesTTestDecorator) { TVector<THolder<IActor>> actors(1); actors[0] = CreateFizzBuzzSender(); //actors[1] = CreateFizzBuzzSender(); - THolder<IActor> testActor = MakeHolder<TTestMasterActor>(std::move(actors), edgeActor); + THolder<IActor> testActor = MakeHolder<TTestMasterActor>(std::move(actors), edgeActor); Write("Start test"); runtime.Register(testActor.Release()); diff --git a/library/cpp/actors/util/queue_oneone_inplace.h b/library/cpp/actors/util/queue_oneone_inplace.h index d7ec8bb21c..a473c500b8 100644 --- a/library/cpp/actors/util/queue_oneone_inplace.h +++ b/library/cpp/actors/util/queue_oneone_inplace.h @@ -53,7 +53,7 @@ public: } struct TPtrCleanDestructor { - static inline void Destroy(TOneOneQueueInplace<T, TSize>* x) noexcept { + static inline void Destroy(TOneOneQueueInplace<T, TSize>* x) noexcept { while (T head = x->Pop()) delete head; delete x; @@ -61,7 +61,7 @@ public: }; struct TCleanDestructor { - static inline void Destroy(TOneOneQueueInplace<T, TSize>* x) noexcept { + static inline void Destroy(TOneOneQueueInplace<T, TSize>* x) noexcept { while (x->Pop() != nullptr) continue; delete x; @@ -70,7 +70,7 @@ public: struct TPtrCleanInplaceMallocDestructor { template <typename TPtrVal> - static inline void Destroy(TOneOneQueueInplace<TPtrVal*, TSize>* x) noexcept { + static inline void Destroy(TOneOneQueueInplace<TPtrVal*, TSize>* x) noexcept { while (TPtrVal* head = x->Pop()) { head->~TPtrVal(); free(head); @@ -79,7 +79,7 @@ public: } }; - void Push(T x) noexcept { + void Push(T x) noexcept { if (WritePosition != TChunk::EntriesCount) { AtomicStore(&WriteTo->Entries[WritePosition], x); ++WritePosition; diff --git a/library/cpp/actors/util/thread.h b/library/cpp/actors/util/thread.h index d742c8c585..5f7bc27b69 100644 --- a/library/cpp/actors/util/thread.h +++ b/library/cpp/actors/util/thread.h @@ -18,9 +18,9 @@ inline void SetCurrentThreadName(const TString& name, TStringStream linuxName; linuxName << procName << "." << name; - TThread::SetCurrentThreadName(linuxName.Str().data()); + TThread::SetCurrentThreadName(linuxName.Str().data()); #else Y_UNUSED(maxCharsFromProcessName); - TThread::SetCurrentThreadName(name.data()); + TThread::SetCurrentThreadName(name.data()); #endif } diff --git a/library/cpp/actors/util/threadparkpad.cpp b/library/cpp/actors/util/threadparkpad.cpp index 74069ff15b..6d5701e109 100644 --- a/library/cpp/actors/util/threadparkpad.cpp +++ b/library/cpp/actors/util/threadparkpad.cpp @@ -19,25 +19,25 @@ namespace NActors { ~TImpl() { } - bool Park() noexcept { + bool Park() noexcept { __atomic_fetch_sub(&Futex, 1, __ATOMIC_SEQ_CST); while (__atomic_load_n(&Futex, __ATOMIC_ACQUIRE) == -1) SysFutex(&Futex, FUTEX_WAIT_PRIVATE, -1, nullptr, nullptr, 0); return IsInterrupted(); } - void Unpark() noexcept { + void Unpark() noexcept { const int old = __atomic_fetch_add(&Futex, 1, __ATOMIC_SEQ_CST); if (old == -1) SysFutex(&Futex, FUTEX_WAKE_PRIVATE, -1, nullptr, nullptr, 0); } - void Interrupt() noexcept { + void Interrupt() noexcept { __atomic_store_n(&Interrupted, true, __ATOMIC_SEQ_CST); Unpark(); } - bool IsInterrupted() const noexcept { + bool IsInterrupted() const noexcept { return __atomic_load_n(&Interrupted, __ATOMIC_ACQUIRE); } }; @@ -59,26 +59,26 @@ namespace NActors { if (!EvHandle) ythrow TWithBackTrace<yexception>() << "::CreateEvent failed"; } - ~TImpl() { + ~TImpl() { if (EvHandle) ::CloseHandle(EvHandle); } - bool Park() noexcept { + bool Park() noexcept { ::WaitForSingleObject(EvHandle, INFINITE); return AtomicGet(Interrupted); } - void Unpark() noexcept { + void Unpark() noexcept { ::SetEvent(EvHandle); } - void Interrupt() noexcept { + void Interrupt() noexcept { AtomicSet(Interrupted, true); Unpark(); } - bool IsInterrupted() const noexcept { + bool IsInterrupted() const noexcept { return AtomicGet(Interrupted); } }; @@ -98,24 +98,24 @@ namespace NActors { , Ev(TSystemEvent::rAuto) { } - ~TImpl() { + ~TImpl() { } - bool Park() noexcept { + bool Park() noexcept { Ev.Wait(); return AtomicGet(Interrupted); } - void Unpark() noexcept { + void Unpark() noexcept { Ev.Signal(); } - void Interrupt() noexcept { + void Interrupt() noexcept { AtomicSet(Interrupted, true); Unpark(); } - bool IsInterrupted() const noexcept { + bool IsInterrupted() const noexcept { return AtomicGet(Interrupted); } }; @@ -126,22 +126,22 @@ namespace NActors { { } - TThreadParkPad::~TThreadParkPad() { + TThreadParkPad::~TThreadParkPad() { } - bool TThreadParkPad::Park() noexcept { + bool TThreadParkPad::Park() noexcept { return Impl->Park(); } - void TThreadParkPad::Unpark() noexcept { + void TThreadParkPad::Unpark() noexcept { Impl->Unpark(); } - void TThreadParkPad::Interrupt() noexcept { + void TThreadParkPad::Interrupt() noexcept { Impl->Interrupt(); } - bool TThreadParkPad::Interrupted() const noexcept { + bool TThreadParkPad::Interrupted() const noexcept { return Impl->IsInterrupted(); } diff --git a/library/cpp/actors/util/threadparkpad.h b/library/cpp/actors/util/threadparkpad.h index 5b574ccf34..a3f33e601a 100644 --- a/library/cpp/actors/util/threadparkpad.h +++ b/library/cpp/actors/util/threadparkpad.h @@ -10,12 +10,12 @@ namespace NActors { public: TThreadParkPad(); - ~TThreadParkPad(); + ~TThreadParkPad(); - bool Park() noexcept; - void Unpark() noexcept; - void Interrupt() noexcept; - bool Interrupted() const noexcept; + bool Park() noexcept; + void Unpark() noexcept; + void Interrupt() noexcept; + bool Interrupted() const noexcept; }; } diff --git a/library/cpp/actors/util/ticket_lock.h b/library/cpp/actors/util/ticket_lock.h index 3b1fa80393..c6c6aebb32 100644 --- a/library/cpp/actors/util/ticket_lock.h +++ b/library/cpp/actors/util/ticket_lock.h @@ -15,11 +15,11 @@ public: { } - void Release() noexcept { + void Release() noexcept { AtomicUi32Increment(&TicketOut); } - ui32 Acquire() noexcept { + ui32 Acquire() noexcept { ui32 revolves = 0; const ui32 ticket = AtomicUi32Increment(&TicketIn) - 1; while (ticket != AtomicLoad(&TicketOut)) { @@ -30,7 +30,7 @@ public: return revolves; } - bool TryAcquire() noexcept { + bool TryAcquire() noexcept { const ui32 x = AtomicLoad(&TicketOut); if (x == AtomicLoad(&TicketIn) && AtomicUi32Cas(&TicketIn, x + 1, x)) return true; @@ -38,7 +38,7 @@ public: return false; } - bool IsLocked() noexcept { + bool IsLocked() noexcept { const ui32 ticketIn = AtomicLoad(&TicketIn); const ui32 ticketOut = AtomicLoad(&TicketOut); return (ticketIn != ticketOut); |