Class: Concur::NeverBlockExecutor
- Inherits:
-
Object
- Object
- Concur::NeverBlockExecutor
- Defined in:
- lib/executors/never_block_executor.rb
Instance Method Summary collapse
- #execute(runnable = nil, &blk) ⇒ Object
-
#initialize(max_size) ⇒ NeverBlockExecutor
constructor
A new instance of NeverBlockExecutor.
- #shutdown ⇒ Object
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 |
#shutdown ⇒ Object
22 23 24 |
# File 'lib/executors/never_block_executor.rb', line 22 def shutdown end |