mirror of https://github.com/panjf2000/ants.git
Update comment
This commit is contained in:
parent
001c8b5e1b
commit
21f632368a
9
ants.go
9
ants.go
|
@ -76,16 +76,15 @@ var (
|
||||||
// to get the best performance. Inspired by fasthttp at
|
// 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 channel if GOMAXPROCS=1.
|
||||||
// This immediately switches Serve to WorkerFunc, which results
|
// This switches context from sender to receiver immediately,
|
||||||
// in higher performance (under go1.5 at least).
|
// which results in higher performance (under go1.5 at least).
|
||||||
if runtime.GOMAXPROCS(0) == 1 {
|
if runtime.GOMAXPROCS(0) == 1 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use non-blocking workerChan if GOMAXPROCS>1,
|
// Use non-blocking workerChan if GOMAXPROCS>1,
|
||||||
// since otherwise the Serve caller (Acceptor) may lag accepting
|
// since otherwise the sender might be dragged down if the receiver is CPU-bound.
|
||||||
// new connections if WorkerFunc is CPU-bound.
|
|
||||||
return 1
|
return 1
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue