class RemiLib::JobPool(T)
- RemiLib::JobPool(T)
- Reference
- Object
Overview
A JobPool
allows you to perform work on an enumerable set of things,
spreading the work out over a set of fibers.
Defined in:
remilib/concurrency.crConstructors
-
.new(name : String | Nil = nil)
Creates a new
JobPool
with the number of workers equal to the number of logical CPUs in the system. -
.new(workers : Int32, name : String | Nil = nil)
Creates a new
JobPool
with the given number of workers.
Instance Method Summary
-
#errors : Array(Exception)
Holds the errors that occurred during
#run
. -
#run(things : Enumerable, &block : T -> Nil)
Runs the pool, assigning one element of
things
to each job. -
#workers : Int32
The maximum number of jobs that this
JobPool
can handle.
Constructor Detail
def self.new(name : String | Nil = nil)
#
Creates a new JobPool
with the number of workers equal to the number of
logical CPUs in the system.
Creates a new JobPool
with the given number of workers. This must be
greater than zero.