From 1444008b67d4a14219f9ba2c038f60106dcbcd48 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 3 Aug 2018 19:28:46 +0800 Subject: [PATCH] rename methods --- pool.go | 10 +++++----- pool_func.go | 10 +++++----- worker.go | 2 +- worker_func.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pool.go b/pool.go index 96873cd..f430e04 100644 --- a/pool.go +++ b/pool.go @@ -172,13 +172,13 @@ func (p *Pool) Release() error { //------------------------------------------------------------------------- -// incrRunning increases the number of the currently running goroutines -func (p *Pool) incrRunning() { +// incRunning increases the number of the currently running goroutines +func (p *Pool) incRunning() { atomic.AddInt32(&p.running, 1) } -// decrRunning decreases the number of the currently running goroutines -func (p *Pool) decrRunning() { +// decRunning decreases the number of the currently running goroutines +func (p *Pool) decRunning() { atomic.AddInt32(&p.running, -1) } @@ -215,7 +215,7 @@ func (p *Pool) getWorker() *Worker { task: make(chan f, 1), } w.run() - p.incrRunning() + p.incRunning() } return w } diff --git a/pool_func.go b/pool_func.go index ee8c9c5..dcb9f1d 100644 --- a/pool_func.go +++ b/pool_func.go @@ -177,13 +177,13 @@ func (p *PoolWithFunc) Release() error { //------------------------------------------------------------------------- -// incrRunning increases the number of the currently running goroutines -func (p *PoolWithFunc) incrRunning() { +// incRunning increases the number of the currently running goroutines +func (p *PoolWithFunc) incRunning() { atomic.AddInt32(&p.running, 1) } -// decrRunning decreases the number of the currently running goroutines -func (p *PoolWithFunc) decrRunning() { +// decRunning decreases the number of the currently running goroutines +func (p *PoolWithFunc) decRunning() { atomic.AddInt32(&p.running, -1) } @@ -220,7 +220,7 @@ func (p *PoolWithFunc) getWorker() *WorkerWithFunc { args: make(chan interface{}, 1), } w.run() - p.incrRunning() + p.incRunning() } return w } diff --git a/worker.go b/worker.go index aa4e761..a0c2faf 100644 --- a/worker.go +++ b/worker.go @@ -46,7 +46,7 @@ func (w *Worker) run() { go func() { for f := range w.task { if f == nil { - w.pool.decrRunning() + w.pool.decRunning() return } f() diff --git a/worker_func.go b/worker_func.go index 277ee31..a02264b 100644 --- a/worker_func.go +++ b/worker_func.go @@ -46,7 +46,7 @@ func (w *WorkerWithFunc) run() { go func() { for args := range w.args { if args == nil { - w.pool.decrRunning() + w.pool.decRunning() return } w.pool.poolFunc(args)