Class: Concur::NeverBlockExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/executors/never_block_executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(max_size) ⇒ NeverBlockExecutor

Returns a new instance of NeverBlockExecutor.



9
10
11
# File 'lib/executors/never_block_executor.rb', line 9

def initialize(max_size)
  @fiber_pool = NeverBlock::Pool::FiberPool.new(max_size)
end

Instance Method Details

#execute(runnable = nil, &blk) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/executors/never_block_executor.rb', line 13

def execute(runnable=nil, &blk)
  f = Future.new(runnable, &blk)
  @fiber_pool.spawn do
      puts 'running in spawn'
    f.call
  end
  f
end

#shutdownObject



22
23
24
# File 'lib/executors/never_block_executor.rb', line 22

def shutdown

end