function Pool(script, options) {
  if (typeof script === 'string') {
    /** @readonly */
    this.script = script || null;
  }
  else {
    this.script = null;
    options = script;
  }

  /** @private */
  this.workers = [];  // queue with all workers
  /** @private */
  this.tasks = [];    // queue with tasks awaiting execution

  options = options || {};

  /** @readonly */
  this.forkArgs = Object.freeze(options.forkArgs || []);
  /** @readonly */
  this.forkOpts = Object.freeze(options.forkOpts || {});
  /** @readonly */
  this.workerOpts = Object.freeze(options.workerOpts || {});
  /** @readonly */
  this.workerThreadOpts = Object.freeze(options.workerThreadOpts || {})
  /** @private */
  this.debugPortStart = (options.debugPortStart || 43210);
  /** @readonly @deprecated */
  this.nodeWorker = options.nodeWorker;
  /** @readonly
   * @type {'auto' | 'web' | 'process' | 'thread'}
   */
  this.workerType = options.workerType || options.nodeWorker || 'auto'
  /** @readonly */
  this.maxQueueSize = options.maxQueueSize || Infinity;
  /** @readonly */
  this.workerTerminateTimeout = options.workerTerminateTimeout || 1000;

  /** @readonly */
  this.onCreateWorker = options.onCreateWorker || (() => null);
  /** @readonly */
  this.onTerminateWorker = options.onTerminateWorker || (() => null);

  /** @readonly */
  this.emitStdStreams = options.emitStdStreams || false

  // configuration
  if (options && 'maxWorkers' in options) {
    validateMaxWorkers(options.maxWorkers);
    /** @readonly */
    this.maxWorkers = options.maxWorkers;
  }
  else {
    this.maxWorkers = Math.max((environment.cpus || 4) - 1, 1);
  }

  if (options && 'minWorkers' in options) {
    if(options.minWorkers === 'max') {
      /** @readonly */
      this.minWorkers = this.maxWorkers;
    } else {
      validateMinWorkers(options.minWorkers);
      this.minWorkers = options.minWorkers;
      this.maxWorkers = Math.max(this.minWorkers, this.maxWorkers);     // in case minWorkers is higher than maxWorkers
    }
    this._ensureMinWorkers();
  }

  /** @private */
  this._boundNext = this._next.bind(this);


  if (this.workerType === 'thread') {
    WorkerHandler.ensureWorkerThreads();
  }
}
A pool to manage workers, which can be created using the function workerpool.pool.

@param {String} [script]   Optional worker script
@param {import('./types.js').WorkerPoolOptions} [options]  See docs
@constructor