rename methods

This commit is contained in:
Andy Pan 2018-08-03 19:28:46 +08:00
parent 39951bd2f5
commit 1444008b67
4 changed files with 12 additions and 12 deletions

10
pool.go
View File

@ -172,13 +172,13 @@ func (p *Pool) Release() error {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// incrRunning increases the number of the currently running goroutines // incRunning increases the number of the currently running goroutines
func (p *Pool) incrRunning() { func (p *Pool) incRunning() {
atomic.AddInt32(&p.running, 1) atomic.AddInt32(&p.running, 1)
} }
// decrRunning decreases the number of the currently running goroutines // decRunning decreases the number of the currently running goroutines
func (p *Pool) decrRunning() { func (p *Pool) decRunning() {
atomic.AddInt32(&p.running, -1) atomic.AddInt32(&p.running, -1)
} }
@ -215,7 +215,7 @@ func (p *Pool) getWorker() *Worker {
task: make(chan f, 1), task: make(chan f, 1),
} }
w.run() w.run()
p.incrRunning() p.incRunning()
} }
return w return w
} }

View File

@ -177,13 +177,13 @@ func (p *PoolWithFunc) Release() error {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// incrRunning increases the number of the currently running goroutines // incRunning increases the number of the currently running goroutines
func (p *PoolWithFunc) incrRunning() { func (p *PoolWithFunc) incRunning() {
atomic.AddInt32(&p.running, 1) atomic.AddInt32(&p.running, 1)
} }
// decrRunning decreases the number of the currently running goroutines // decRunning decreases the number of the currently running goroutines
func (p *PoolWithFunc) decrRunning() { func (p *PoolWithFunc) decRunning() {
atomic.AddInt32(&p.running, -1) atomic.AddInt32(&p.running, -1)
} }
@ -220,7 +220,7 @@ func (p *PoolWithFunc) getWorker() *WorkerWithFunc {
args: make(chan interface{}, 1), args: make(chan interface{}, 1),
} }
w.run() w.run()
p.incrRunning() p.incRunning()
} }
return w return w
} }

View File

@ -46,7 +46,7 @@ func (w *Worker) run() {
go func() { go func() {
for f := range w.task { for f := range w.task {
if f == nil { if f == nil {
w.pool.decrRunning() w.pool.decRunning()
return return
} }
f() f()

View File

@ -46,7 +46,7 @@ func (w *WorkerWithFunc) run() {
go func() { go func() {
for args := range w.args { for args := range w.args {
if args == nil { if args == nil {
w.pool.decrRunning() w.pool.decRunning()
return return
} }
w.pool.poolFunc(args) w.pool.poolFunc(args)