From f62e8ab1e0a951ab278ac794979b27ebd89ab0b5 Mon Sep 17 00:00:00 2001 From: Zhening Li Date: Mon, 13 Sep 2021 11:57:25 +0800 Subject: [PATCH] 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> --- README.md | 2 +- README_ZH.md | 2 +- ants.go | 2 +- options.go | 2 +- pool.go | 4 ++-- pool_func.go | 6 +++--- worker.go | 2 +- worker_func.go | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 35b50b2..0071fd9 100644 --- a/README.md +++ b/README.md @@ -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.       diff --git a/README_ZH.md b/README_ZH.md index c43a485..ec3c901 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -353,7 +353,7 @@ pool.Reboot() ## ☕️ 打赏 -> 当您通过以下方式进行捐赠时,请务必留下姓名、Github账号或其他社交媒体账号,以便我将其添加到捐赠者名单中,以表谢意。 +> 当您通过以下方式进行捐赠时,请务必留下姓名、GitHub 账号或其他社交媒体账号,以便我将其添加到捐赠者名单中,以表谢意。       diff --git a/ants.go b/ants.go index 2b4cde4..3433028 100644 --- a/ants.go +++ b/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) ) diff --git a/options.go b/options.go index 5235f96..caa830b 100644 --- a/options.go +++ b/options.go @@ -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 diff --git a/pool.go b/pool.go index 460d0fd..f70c12a 100644 --- a/pool.go +++ b/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) diff --git a/pool_func.go b/pool_func.go index 83d8771..3e71d2f 100644 --- a/pool_func.go +++ b/pool_func.go @@ -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 { diff --git a/worker.go b/worker.go index 3fb8333..b804e9f 100644 --- a/worker.go +++ b/worker.go @@ -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 } diff --git a/worker_func.go b/worker_func.go index a123dc3..9fe35e9 100644 --- a/worker_func.go +++ b/worker_func.go @@ -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 }