From 843c43c97ac725533f9da90a17d51de08d1243f4 Mon Sep 17 00:00:00 2001 From: "Ben Sheldon [he/him]" Date: Mon, 20 Oct 2025 03:10:43 -0700 Subject: [PATCH] Replace ThreadingHelper wait loop with functional CyclicBarrier (#36508) --- spec/support/threading_helpers.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/support/threading_helpers.rb b/spec/support/threading_helpers.rb index edf45822ca..4ca8c9865a 100644 --- a/spec/support/threading_helpers.rb +++ b/spec/support/threading_helpers.rb @@ -1,17 +1,18 @@ # frozen_string_literal: true +require 'concurrent/atomic/cyclic_barrier' + module ThreadingHelpers def multi_threaded_execution(thread_count) - wait_for_start = true + barrier = Concurrent::CyclicBarrier.new(thread_count) threads = Array.new(thread_count) do Thread.new do - true while wait_for_start + barrier.wait yield end end - wait_for_start = false threads.each(&:join) end end