From f16061a21b6690df497d2680bae0d9fce89dcbfe Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Sat, 26 Sep 2026 00:39:35 +0200 Subject: [PATCH] test: yield in the mt_reactor spin-wait MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The runner-entry wait spun on an atomic load with an empty body. Under Valgrind's serialized scheduler the spinning main thread can starve the two freshly created runner threads of their first slice, so the wait never completes and the suite hangs silently — the Drone Valgrind stage hit this roughly one build in three. Yielding lets the scheduler run the starved threads, matching the identical wait in io_context.cpp. --- test/unit/mt_reactor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/mt_reactor.cpp b/test/unit/mt_reactor.cpp index 0bf91c4c8..a5ba428fa 100644 --- a/test/unit/mt_reactor.cpp +++ b/test/unit/mt_reactor.cpp @@ -119,9 +119,11 @@ struct mt_reactor_test }; std::thread ra(slice), rb(slice); + // Yield while spinning: under Valgrind's serialized scheduler + // a tight spin starves the freshly created runner threads of + // their first slice, and the wait never completes. while (entered.load() < 2) - { - } + std::this_thread::yield(); for (int i = 0; i < 20; ++i) { // The counter travels as a parameter: a loop-scoped