Add common ThreadingHelper module for specs (#29116)
This commit is contained in:
1 parent
dbafec88e5
commit
95da28d201
6 files changed
+40
-57
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user