From bd456c276f3deb8985d4b0e60a04c4d467ef83d3 Mon Sep 17 00:00:00 2001 From: Roman Gershman Date: Mon, 6 Jul 2026 14:23:13 +0300 Subject: [PATCH] chore: small fixes post #605 --- util/fibers/fiberqueue_threadpool.cc | 26 +++++++++++++++----------- util/fibers/fiberqueue_threadpool.h | 4 +++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/util/fibers/fiberqueue_threadpool.cc b/util/fibers/fiberqueue_threadpool.cc index 6405759c..a1999a61 100644 --- a/util/fibers/fiberqueue_threadpool.cc +++ b/util/fibers/fiberqueue_threadpool.cc @@ -38,22 +38,26 @@ void FiberQueue::Run() { return false; }; - while (true) { - pull_ec_.await(cb); + try { + while (true) { + pull_ec_.await(cb); - if (is_closed) - break; + if (is_closed) + break; - while (count < kBatchSize && queue_.try_dequeue_sc(batch[count])) { - ++count; - } + while (count < kBatchSize && queue_.try_dequeue_sc(batch[count])) { + ++count; + } - push_ec_.notifyAll(); + push_ec_.notifyAll(); - for (unsigned i = 0; i < count; ++i) { - batch[i](); + for (unsigned i = 0; i < count; ++i) { + batch[i](); + } + count = 0; } - count = 0; + } catch (const std::exception& ex) { + LOG(FATAL) << "Exception " << ex.what(); } } diff --git a/util/fibers/fiberqueue_threadpool.h b/util/fibers/fiberqueue_threadpool.h index e28bdb3e..f203505e 100644 --- a/util/fibers/fiberqueue_threadpool.h +++ b/util/fibers/fiberqueue_threadpool.h @@ -108,7 +108,7 @@ class FiberQueue { void Run(); - unsigned blocked_submitters() const { + static unsigned blocked_submitters() { return blocked_submitters_; } @@ -173,7 +173,9 @@ class FiberQueueThreadPool { break; } + main_w.q->blocked_submitters_++; main_w.q->push_ec_.wait(key.epoch()); + main_w.q->blocked_submitters_--; } }