0
0
Fork 0

Add common ThreadingHelper module for specs (#29116)

This commit is contained in:
Matt Jankowski 2024-02-07 09:53:29 -05:00 committed by GitHub
parent dbafec88e5
commit 95da28d201
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 57 deletions

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
module ThreadingHelpers
def multi_threaded_execution(thread_count)
wait_for_start = true
threads = Array.new(thread_count) do
Thread.new do
true while wait_for_start
yield
end
end
wait_for_start = false
threads.each(&:join)
end
end