WorkerPool<W extends Worker> constructor

WorkerPool<W extends Worker>(
  1. WorkerFactory<W> _workerFactory, {
  2. ConcurrencySettings? concurrencySettings,
})

Create a worker pool.

Workers are instantiated using the provided _workerFactory. The pool will only instantiate workers as needed, depending on concurrencySettings. The ConcurrencySettings.minWorkers and ConcurrencySettings.maxWorkers settings control how many workers will live in the pool. The ConcurrencySettings.maxParallel setting controls how many tasks can be posted to each individual worker in the pool.

Implementation

WorkerPool(this._workerFactory, {ConcurrencySettings? concurrencySettings})
    : concurrencySettings = concurrencySettings ?? ConcurrencySettings();