Fix typos and add comments

This commit is contained in:
Andy Pan 2019-10-15 14:50:38 +08:00
parent 8138a23edd
commit 52b301019a
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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")
)