From 6fb91e661c0db8680b3a3bc69f34a9eb1fcc1ff5 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max.kellermann@ionos.com> Date: Mon, 20 Jan 2025 18:38:34 +0100 Subject: [PATCH] io/uring/Queue: DispatchCompletions() returns bool --- src/io/uring/Queue.hxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/io/uring/Queue.hxx b/src/io/uring/Queue.hxx index 9410c6a8e..0f5f8c0da 100644 --- a/src/io/uring/Queue.hxx +++ b/src/io/uring/Queue.hxx @@ -64,12 +64,28 @@ public: ring.Submit(); } + /** + * @return true if a completion was dispatched, false if the + * completion queue was empty + */ bool DispatchOneCompletion(); - void DispatchCompletions() { - while (DispatchOneCompletion()) {} + /** + * @return true if at least one completion was dispatched, + * false if the completion queue was empty + */ + bool DispatchCompletions() { + bool result = false; + while (DispatchOneCompletion()) { + result = true; + } + return result; } + /** + * @return true if a completion was dispatched, false if the + * completion queue was empty + */ bool WaitDispatchOneCompletion(); void WaitDispatchCompletions() {