Module: Celluloid::ClassMethods
- Extended by:
- Forwardable
- Defined in:
- lib/celluloid/supervision/container/behavior/pool.rb
Instance Method Summary collapse
-
#pool(config = {}, &block) ⇒ Object
Create a new pool of workers.
-
#pool_link(klass, config = {}, &block) ⇒ Object
Same as pool, but links to the pool manager.
Instance Method Details
#pool(config = {}, &block) ⇒ Object
Create a new pool of workers. Accepts the following options:
-
size: how many workers to create. Default is worker per CPU core
-
args: array of arguments to pass when creating a worker
12 13 14 15 |
# File 'lib/celluloid/supervision/container/behavior/pool.rb', line 12 def pool(config={}, &block) _ = Celluloid.supervise((config, block: block, actors: self)) _.actors.last end |
#pool_link(klass, config = {}, &block) ⇒ Object
Same as pool, but links to the pool manager
18 19 20 |
# File 'lib/celluloid/supervision/container/behavior/pool.rb', line 18 def pool_link(klass, config={}, &block) Supervision::Container::Pool.new_link((config, block: block, actors: klass)) end |