mirror of https://github.com/panjf2000/ants.git
🐉 Optimize code comments
This commit is contained in:
parent
24c28c985c
commit
65b3ac9ff7
8
pool.go
8
pool.go
|
@ -119,7 +119,7 @@ func NewTimingPool(size, expiry int) (*Pool, error) {
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// Submit submits a task to this pool.
|
// Submit submits a task to this pool.
|
||||||
func (p *Pool) Submit(task f) error {
|
func (p *Pool) Submit(task f) error {
|
||||||
|
@ -173,7 +173,7 @@ func (p *Pool) Release() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// incRunning increases the number of the currently running goroutines.
|
// incRunning increases the number of the currently running goroutines.
|
||||||
func (p *Pool) incRunning() {
|
func (p *Pool) incRunning() {
|
||||||
|
@ -230,7 +230,7 @@ func (p *Pool) putWorker(worker *Worker) {
|
||||||
worker.recycleTime = time.Now()
|
worker.recycleTime = time.Now()
|
||||||
p.lock.Lock()
|
p.lock.Lock()
|
||||||
p.workers = append(p.workers, worker)
|
p.workers = append(p.workers, worker)
|
||||||
// Notify there is an available worker put back into queue.
|
// Notify the invoker stuck in 'getWorker()' of there is an available worker in the worker queue.
|
||||||
p.cond.Signal()
|
p.cond.Signal()
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
}
|
}
|
Loading…
Reference in New Issue