From 3e306dfc87eef33670765d97b72a833628e04cba Mon Sep 17 00:00:00 2001 From: kulikov Date: Mon, 23 Mar 2026 17:14:35 +0300 Subject: Allow to change (reduce) max queue size for common elastic queue Add same method as in TFastElasticQueue, and test. commit_hash:0a2b618325e57c32fd269254a7dbe912849c3f10 --- library/cpp/threading/equeue/equeue.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'library/cpp/threading/equeue/equeue.h') diff --git a/library/cpp/threading/equeue/equeue.h b/library/cpp/threading/equeue/equeue.h index 4d03ad051db..a76271c27ea 100644 --- a/library/cpp/threading/equeue/equeue.h +++ b/library/cpp/threading/equeue/equeue.h @@ -17,13 +17,20 @@ public: void Stop() noexcept override; size_t ObjectCount() const; + + void SetCurrentMaxQueueSize(size_t v) { + Y_ENSURE(v <= MaxQueueSize_); + CurrentMaxQueueSize_ = v; + } private: class TDecrementingWrapper; bool TryIncCounter(); private: THolder SlaveQueue_; + size_t MaxQueueSize_ = 0; + std::atomic CurrentMaxQueueSize_ = 0; std::atomic ObjectCount_ = 0; std::atomic GuardCount_ = 0; }; -- cgit v1.3