You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
# 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
|
|
|