From 99c0ebbafdea901b71fb0be0696bc2b6fa58f0f6 Mon Sep 17 00:00:00 2001 From: aneporada Date: Wed, 21 Dec 2022 18:57:29 +0300 Subject: BlockExpandChunked: add forgotten file --- library/cpp/neh/multiclient.cpp | 2 +- library/cpp/neh/wfmo.h | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 19 deletions(-) (limited to 'library/cpp') diff --git a/library/cpp/neh/multiclient.cpp b/library/cpp/neh/multiclient.cpp index cb7672755e3..650688ae6b2 100644 --- a/library/cpp/neh/multiclient.cpp +++ b/library/cpp/neh/multiclient.cpp @@ -280,7 +280,7 @@ namespace { void ScheduleRequest(TIntrusivePtr& rs, const THandleRef& h, const TInstant& deadline) { TJobPtr j(new TNewRequest(rs)); JQ_.Enqueue(j); - if (!h->Signalled) { + if (!h->Signalled()) { if (deadline.GetValue() < GetNearDeadline_()) { Signal(); } diff --git a/library/cpp/neh/wfmo.h b/library/cpp/neh/wfmo.h index a51d3916123..15d92e3ef58 100644 --- a/library/cpp/neh/wfmo.h +++ b/library/cpp/neh/wfmo.h @@ -28,37 +28,42 @@ namespace NNeh { class TWaitQueue { public: - struct TWaitHandle { - inline TWaitHandle() noexcept - : Signalled(false) - , Parent(nullptr) - { - } - - inline void Signal() noexcept { + class TWaitHandle { + public: + void Signal() noexcept { TGuard lock(M_); - Signalled = true; + Signalled_ = true; - if (Parent) { - Parent->Notify(this); + if (Parent_) { + Parent_->Notify(this); } } - inline void Register(TWaitQueue* parent) noexcept { + void Register(TWaitQueue* parent) noexcept { TGuard lock(M_); - Parent = parent; + Parent_ = parent; - if (Signalled) { - if (Parent) { - Parent->Notify(this); + if (Signalled_) { + if (Parent_) { + Parent_->Notify(this); } } } - NAtomic::TBool Signalled; - TWaitQueue* Parent; + bool Signalled() const { + return Signalled_; + } + + void ResetState() { + TGuard lock(M_); + + Signalled_ = false; + } + private: + NAtomic::TBool Signalled_ = false; + TWaitQueue* Parent_ = nullptr; TSpinLock M_; }; -- cgit v1.3