mirror of https://github.com/panjf2000/ants.git
style: fixed some typos in the comments (#184)
* style: fixed some typos in the comments * style: add space between en and zh words Co-authored-by: Zhening <18501262663@163.com>
This commit is contained in:
parent
6de43fdfb9
commit
f62e8ab1e0
|
@ -352,7 +352,7 @@ Become a bronze sponsor with a monthly donation of $10 and get your logo on our
|
|||
|
||||
## ☕️ Buy me a coffee
|
||||
|
||||
> Please be sure to leave your name, Github account or other social media accounts when you donate by the following means so that I can add it to the list of donors as a token of my appreciation.
|
||||
> Please be sure to leave your name, GitHub account or other social media accounts when you donate by the following means so that I can add it to the list of donors as a token of my appreciation.
|
||||
|
||||
<img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/payments/WeChatPay.JPG" width="250" align="middle"/>
|
||||
<img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/payments/AliPay.JPG" width="250" align="middle"/>
|
||||
|
|
|
@ -353,7 +353,7 @@ pool.Reboot()
|
|||
|
||||
## ☕️ 打赏
|
||||
|
||||
> 当您通过以下方式进行捐赠时,请务必留下姓名、Github账号或其他社交媒体账号,以便我将其添加到捐赠者名单中,以表谢意。
|
||||
> 当您通过以下方式进行捐赠时,请务必留下姓名、GitHub 账号或其他社交媒体账号,以便我将其添加到捐赠者名单中,以表谢意。
|
||||
|
||||
<img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/payments/WeChatPay.JPG" width="250" align="middle"/>
|
||||
<img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/payments/AliPay.JPG" width="250" align="middle"/>
|
||||
|
|
2
ants.go
2
ants.go
|
@ -90,7 +90,7 @@ var (
|
|||
|
||||
defaultLogger = Logger(log.New(os.Stderr, "", log.LstdFlags))
|
||||
|
||||
// Init a instance pool when importing ants.
|
||||
// Init an instance pool when importing ants.
|
||||
defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)
|
||||
)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ func loadOptions(options ...Option) *Options {
|
|||
return opts
|
||||
}
|
||||
|
||||
// Options contains all options which will be applied when instantiating a ants pool.
|
||||
// Options contains all options which will be applied when instantiating an ants pool.
|
||||
type Options struct {
|
||||
// ExpiryDuration is a period for the scavenger goroutine to clean up those expired workers,
|
||||
// the scavenger scans all workers every `ExpiryDuration` and clean up those workers that haven't been
|
||||
|
|
4
pool.go
4
pool.go
|
@ -52,7 +52,7 @@ type Pool struct {
|
|||
// cond for waiting to get a idle worker.
|
||||
cond *sync.Cond
|
||||
|
||||
// workerCache speeds up the obtainment of the an usable worker in function:retrieveWorker.
|
||||
// workerCache speeds up the obtainment of a usable worker in function:retrieveWorker.
|
||||
workerCache sync.Pool
|
||||
|
||||
// blockingNum is the number of the goroutines already been blocked on pool.Submit, protected by pool.lock
|
||||
|
@ -216,7 +216,7 @@ func (p *Pool) 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 *Pool) retrieveWorker() (w *goWorker) {
|
||||
spawnWorker := func() {
|
||||
w = p.workerCache.Get().(*goWorker)
|
||||
|
|
|
@ -48,13 +48,13 @@ type PoolWithFunc struct {
|
|||
// state is used to notice the pool to closed itself.
|
||||
state int32
|
||||
|
||||
// cond for waiting to get a idle worker.
|
||||
// cond for waiting to get an idle worker.
|
||||
cond *sync.Cond
|
||||
|
||||
// poolFunc is the function for processing tasks.
|
||||
poolFunc func(interface{})
|
||||
|
||||
// workerCache speeds up the obtainment of the an usable worker in function:retrieveWorker.
|
||||
// workerCache speeds up the obtainment of a usable worker in function:retrieveWorker.
|
||||
workerCache sync.Pool
|
||||
|
||||
// blockingNum is the number of the goroutines already been blocked on pool.Submit, protected by pool.lock
|
||||
|
@ -99,7 +99,7 @@ func (p *PoolWithFunc) purgePeriodically() {
|
|||
expiredWorkers[i] = nil
|
||||
}
|
||||
|
||||
// There might be a situation that all workers have been cleaned up(no any worker is running)
|
||||
// There might be a situation that all workers have been cleaned up(no worker is running)
|
||||
// while some invokers still get stuck in "p.cond.Wait()",
|
||||
// then it ought to wake all those invokers.
|
||||
if p.Running() == 0 {
|
||||
|
|
|
@ -37,7 +37,7 @@ type goWorker struct {
|
|||
// task is a job should be done.
|
||||
task chan func()
|
||||
|
||||
// recycleTime will be update when putting a worker back into queue.
|
||||
// recycleTime will be updated when putting a worker back into queue.
|
||||
recycleTime time.Time
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ type goWorkerWithFunc struct {
|
|||
// args is a job should be done.
|
||||
args chan interface{}
|
||||
|
||||
// recycleTime will be update when putting a worker back into queue.
|
||||
// recycleTime will be updated when putting a worker back into queue.
|
||||
recycleTime time.Time
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue