code: func NewPooledWorkerPool(size int, opts PooledWorkerPoolOptions) (PooledWorkerPool, error) {
  	if size <= 0 {
  		return nil, fmt.Errorf("pooled worker pool size too small: %d", size)
  	}
  
  	numShards := opts.NumShards()
  	if int64(size) < numShards {
  		numShards = int64(size)
  	}
  
  	workChs := make([]chan Work, numShards)
  	for i := range workChs {
  		workChs[i] = make(chan Work, int64(size)/numShards)
  	}
  
  	return &pooledWorkerPool{
  		numRoutinesAtomic:     0,
  		numRoutinesGauge:      opts.InstrumentOptions().MetricsScope().Gauge("num-routines"),
  		growOnDemand:          opts.GrowOnDemand(),
  		workChs:               workChs,
  		numShards:             numShards,
  		killWorkerProbability: opts.KillWorkerProbability(),
  		nowFn: opts.NowFn(),
  	}, nil
  }
docs: // NewPooledWorkerPool creates a new worker pool.