Class: Contr::Async::Pool::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/contr/async/pool.rb

Direct Known Subclasses

Fixed, GlobalIO

Instance Method Summary collapse

Instance Method Details

#create_executorObject

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/contr/async/pool.rb', line 13

def create_executor
  raise NotImplementedError, "pool should implement `#create_executor` method"
end

#executorObject



9
10
11
# File 'lib/contr/async/pool.rb', line 9

def executor
  @executor ||= create_executor
end

#future(*args, &block) ⇒ Object



17
18
19
# File 'lib/contr/async/pool.rb', line 17

def future(*args, &block)
  Concurrent::Promises.future_on(executor, *args, &block)
end

#zip(*futures) ⇒ Object



21
22
23
# File 'lib/contr/async/pool.rb', line 21

def zip(*futures)
  Concurrent::Promises.zip_futures_on(executor, *futures)
end