From 52b301019a4bd8cb6b56a3b51d3087cd71b66386 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Tue, 15 Oct 2019 14:50:38 +0800 Subject: [PATCH] Fix typos and add comments --- pool.go | 2 +- pool_func.go | 6 +++--- worker_array.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pool.go b/pool.go index 14e29be..f97e1d7 100644 --- a/pool.go +++ b/pool.go @@ -30,7 +30,7 @@ import ( "github.com/panjf2000/ants/v2/internal" ) -// Pool accept the tasks from client, it limits the total of goroutines to a given number by recycling goroutines. +// Pool accepts the tasks from client, it limits the total of goroutines to a given number by recycling goroutines. type Pool struct { // capacity of the pool. capacity int32 diff --git a/pool_func.go b/pool_func.go index bd5b42f..ed422e5 100644 --- a/pool_func.go +++ b/pool_func.go @@ -30,7 +30,7 @@ import ( "github.com/panjf2000/ants/v2/internal" ) -// PoolWithFunc accept the tasks from client, it limits the total of goroutines to a given number by recycling goroutines. +// PoolWithFunc accepts the tasks from client, it limits the total of goroutines to a given number by recycling goroutines. type PoolWithFunc struct { // capacity of the pool. capacity int32 @@ -186,7 +186,7 @@ func (p *PoolWithFunc) Cap() int { return int(atomic.LoadInt32(&p.capacity)) } -// Tune change the capacity of this pool. +// Tune changes the capacity of this pool. func (p *PoolWithFunc) Tune(size int) { if size < 0 || p.Cap() == size || p.options.PreAlloc { return @@ -194,7 +194,7 @@ func (p *PoolWithFunc) Tune(size int) { atomic.StoreInt32(&p.capacity, int32(size)) } -// Release Closed this pool. +// Release Closes this pool. func (p *PoolWithFunc) Release() { p.once.Do(func() { atomic.StoreInt32(&p.release, 1) diff --git a/worker_array.go b/worker_array.go index a882fe0..053ea32 100644 --- a/worker_array.go +++ b/worker_array.go @@ -6,10 +6,10 @@ import ( ) var ( - // ErrQueueIsFull ... + // ErrQueueIsFull will be returned when the worker queue is full. ErrQueueIsFull = errors.New("the queue is full") - // ErrQueueLengthIsZero ... + // ErrQueueLengthIsZero will be returned when trying to insert item to a released worker queue. ErrQueueLengthIsZero = errors.New("the queue length is zero") )