Class: Concur::MultiThreaded

Inherits:
Executor::Base show all
Defined in:
lib/executor.rb

Overview

Spins off a new thread per job

Instance Method Summary collapse

Methods inherited from Executor::Base

#initialize, #queue_size

Constructor Details

This class inherits a constructor from Concur::Executor::Base

Instance Method Details

#execute(f = nil, channel = nil, &blk) ⇒ Object



95
96
97
# File 'lib/executor.rb', line 95

def execute(f=nil, channel=nil, &blk)
  process(f, channel, &blk)
end

#process(f = nil, channel = nil, &blk) ⇒ Object



86
87
88
89
90
91
92
93
# File 'lib/executor.rb', line 86

def process(f=nil, channel=nil, &blk)
  f = StandardFuture.new(f, channel, &blk)
  @thread = Thread.new do
    f.call
  end
  f.thread = @thread
  f
end

#shutdownObject



99
100
101
# File 'lib/executor.rb', line 99

def shutdown

end