mirror of https://github.com/panjf2000/ants.git
🐒 Comments Enrichment
This commit is contained in:
parent
530fdbb4e0
commit
a6a76fa753
6
ants.go
6
ants.go
|
@ -38,7 +38,7 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Error types for the Ants API.
|
// Error types for the Ants API.
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
// ErrInvalidPoolSize will be returned when setting a negative number as pool capacity.
|
// ErrInvalidPoolSize will be returned when setting a negative number as pool capacity.
|
||||||
ErrInvalidPoolSize = errors.New("invalid size for pool")
|
ErrInvalidPoolSize = errors.New("invalid size for pool")
|
||||||
|
|
||||||
|
@ -47,10 +47,10 @@ var (
|
||||||
|
|
||||||
// ErrPoolClosed will be returned when submitting task to a closed pool.
|
// ErrPoolClosed will be returned when submitting task to a closed pool.
|
||||||
ErrPoolClosed = errors.New("this pool has been closed")
|
ErrPoolClosed = errors.New("this pool has been closed")
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// workerChanCap determines whether the channel of a worker should be a buffered channel
|
// workerChanCap determines whether the channel of a worker should be a buffered channel
|
||||||
// to get the best performance, inspired by fasthttp.
|
// to get the best performance. Inspired by fasthttp at https://github.com/valyala/fasthttp/blob/master/workerpool.go#L139
|
||||||
// https://github.com/valyala/fasthttp/blob/master/workerpool.go#L139
|
|
||||||
workerChanCap = func() int {
|
workerChanCap = func() int {
|
||||||
// Use blocking workerChan if GOMAXPROCS=1.
|
// Use blocking workerChan if GOMAXPROCS=1.
|
||||||
// This immediately switches Serve to WorkerFunc, which results
|
// This immediately switches Serve to WorkerFunc, which results
|
||||||
|
|
Loading…
Reference in New Issue