func NewPool(f func(context.Context), options ...Option) *Pool {
	c := Config{
		ctx:          context.Background(),
		restartDelay: 0,
		idFunc:       DefaultIDFunc,
	}
	for _, o := range options {
		o(&c)
	}
	ctx, cancel := context.WithCancel(c.ctx)
	return &Pool{
		ctx:          ctx,
		cancel:       cancel,
		f:            f,
		restartDelay: c.restartDelay,
		workerMap:    make(map[string]*worker),
		idFunc:       c.idFunc,
	}
}
// NewPool creates a new pool of given worker function.
// Since it starts with zero workers, the pool does not run workers
// until the first call of Resize.
// Workers can retrieve their id from the context using IDFromContext.
NewPool creates a new pool of given worker function.
Since it starts with zero workers, the pool does not run workers
until the first call of Resize.
Workers can retrieve their id from the context using IDFromContext.
// NewPool creates a new pool of given worker function . // Since it starts with zero workers the pool does not run workers // until the first call of Resize . // Workers can retrieve their id from the context using IDFromContext .
func NewPool(f func(context.Context), options ...Option) *Pool {
	c := Config{
		ctx:          context.Background(),
		restartDelay: 0,
		idFunc:       DefaultIDFunc,
	}
	for _, o := range options {
		o(&c)
	}
	ctx, cancel := context.WithCancel(c.ctx)
	return &Pool{
		ctx:          ctx,
		cancel:       cancel,
		f:            f,
		restartDelay: c.restartDelay,
		workerMap:    make(map[string]*worker),
		idFunc:       c.idFunc,
	}
}
func NewPool ( f func ( context . Context ) , options ... Option ) * Pool { c := Config { ctx : context . Background ( ) , restartDelay : 0 , idFunc : DefaultIDFunc , } for _ , o := range options { o ( & c ) } ctx , cancel := context . WithCancel ( c . ctx ) return & Pool { ctx : ctx , cancel : cancel , f : f , restartDelay : c . restartDelay , workerMap : make ( map [ string ] * worker ) , idFunc : c . idFunc , } }
NewPool creates a new pool of given worker function.
NewPool creates a new pool of given worker function .