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/util | |
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/util')
-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 |
5 files changed, 34 insertions, 34 deletions
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); |