Class: Farce::Unshared::Pool

Inherits:
Abstract::Pool show all
Includes:
Farce::Unshareable, Internal::LocalExecutorMethods
Defined in:
lib/farce/unshared/pool.rb

Overview

An elastic pool of thread workers within one Ractor.

Uses the same scaling and fiber schedulers as Pool. Tasks keep their blocks and argument references. auto_local: true ignores mode. With auto_local: false, only :local and smart modes are accepted. The pool cannot be copied or moved to another Ractor. A scheduler constructor may capture objects from this Ractor.

Examples:

Submit work using local state

results = Farce::Unshared::Queue.new
pool    = Farce::Unshared::Pool.new(max_size: 2)
pool.schedule { results.push(:done) }
results.pop # => :done
pool.close

Method Summary

Methods included from Farce::Unshareable

#initialize, #ractor_shareable?

Methods inherited from Abstract::Pool

#at_max_size?, #capacity, #capacity=, #close, #closed?, #closing?, #error, #grow_after, #grow_after=, #initialize, #max_inflight, #max_inflight=, #max_size, #max_size=, #min_size, #min_size=, #schedule, #shrink_after, #shrink_after=, #size, #state, #try_schedule

Methods inherited from Abstract::Executor

#close, #close_all, #closed?, #error, #execute, #local?, #ractor_shareable?, #schedule, #state, #try_schedule

Methods included from Internal::Noncopyable

#duplicable?