module MrDarcy::Drivers::Thread
Public Instance Methods
dispatch(&block)
click to toggle source
Create a new thread with the supplied block and store it on the thread stack.
# File lib/mr_darcy/drivers/thread.rb, line 12 def dispatch(&block) @threads ||= [] @threads << ::Thread.new(&block) end
wait() { || ... }
click to toggle source
Iterate through all threads in the thread stack and wait until they are complete.
# File lib/mr_darcy/drivers/thread.rb, line 19 def wait @threads ||= [] @threads.each do |thread| thread.join unless ::Thread.current == thread end yield end