diff --git a/ants.go b/ants.go index 3433028..4538625 100644 --- a/ants.go +++ b/ants.go @@ -48,12 +48,8 @@ const ( ) var ( - // Error types for the Ants API. - //--------------------------------------------------------------------------- - - // ErrInvalidPoolSize will be returned when setting a negative number as pool capacity, this error will be only used - // by pool with func because pool without func can be infinite by setting up a negative capacity. - ErrInvalidPoolSize = errors.New("invalid size for pool") + // + //--------------------------Error types for the Ants API------------------------------ // ErrLackPoolFunc will be returned when invokers don't provide function for pool. ErrLackPoolFunc = errors.New("must provide function for pool") diff --git a/pool.go b/pool.go index e5762f4..633de17 100644 --- a/pool.go +++ b/pool.go @@ -159,12 +159,12 @@ func (p *Pool) Submit(task func()) error { return nil } -// Running returns the number of the currently running goroutines. +// Running returns the amount of the currently running goroutines. func (p *Pool) Running() int { return int(atomic.LoadInt32(&p.running)) } -// Free returns the available goroutines to work, -1 indicates this pool is unlimited. +// Free returns the amount of available goroutines to work, -1 indicates this pool is unlimited. func (p *Pool) Free() int { c := p.Cap() if c < 0 { diff --git a/pool_func.go b/pool_func.go index b2dfb68..ef2034b 100644 --- a/pool_func.go +++ b/pool_func.go @@ -176,12 +176,12 @@ func (p *PoolWithFunc) Invoke(args interface{}) error { return nil } -// Running returns the number of the currently running goroutines. +// Running returns the amount of the currently running goroutines. func (p *PoolWithFunc) Running() int { return int(atomic.LoadInt32(&p.running)) } -// Free returns an available goroutines to work, -1 indicates this pool is unlimited. +// Free returns the amount of available goroutines to work, -1 indicates this pool is unlimited. func (p *PoolWithFunc) Free() int { c := p.Cap() if c < 0 { @@ -242,7 +242,7 @@ func (p *PoolWithFunc) decRunning() { atomic.AddInt32(&p.running, -1) } -// retrieveWorker returns a available worker to run the tasks. +// retrieveWorker returns an available worker to run the tasks. func (p *PoolWithFunc) retrieveWorker() (w *goWorkerWithFunc) { spawnWorker := func() { w = p.workerCache.Get().(*goWorkerWithFunc)