class

WorkerPool::Pool(A)

Inherits Reference < Object

Constants

Log = ::Log.for(self)

Constructors

new(*, buffer_capacity : Int32, pool_size : Int32, &builder : Channel(A), Int32 -> Worker(A))

Creates a new Pool instance. It spawns as many fiber as specified by pool_size. Each spawned fiber instantiates and start a new Worker

Source

Instance methods

process(workload : A)

Registers new wokload to be processed by the Pool

Source
terminate

Closes the pool so it does not accept new workloads for processing. However, the pool remains operative until workers finish processing all the workload enqueued before terminate was called

Source
wait

Waits until all workers have finished (there are no more active Worker fibers)

Source