Module: MrDarcy::Drivers::Thread

Defined in:
lib/mr_darcy/drivers/thread.rb

Class Method Summary collapse

Class Method Details

.dispatch(&block) ⇒ Object



8
9
10
11
# File 'lib/mr_darcy/drivers/thread.rb', line 8

def dispatch(&block)
  @threads ||= []
  @threads << ::Thread.new(&block)
end

.waitObject



13
14
15
16
17
18
19
# File 'lib/mr_darcy/drivers/thread.rb', line 13

def wait
  @threads ||= []
  @threads.each do |thread|
    thread.join unless ::Thread.current == thread
  end
  yield
end