From 042109890ad36bedd17974ae1dcb1a631377b554 Mon Sep 17 00:00:00 2001 From: andy pan Date: Tue, 31 Jul 2018 11:03:41 +0800 Subject: [PATCH] make some methods unexported --- 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 ac3edcd..ad78fe0 100644 --- a/pool.go +++ b/pool.go @@ -129,13 +129,13 @@ func (p *Pool) Running() int { return int(atomic.LoadInt32(&p.running)) } -// IncrRunning increases the number of the currently running goroutines -func (p *Pool) IncrRunning() { +// incrRunning increases the number of the currently running goroutines +func (p *Pool) incrRunning() { atomic.AddInt32(&p.running, 1) } -// DecrRunning decreases the number of the currently running goroutines -func (p *Pool) DecrRunning() { +// decrRunning decreases the number of the currently running goroutines +func (p *Pool) decrRunning() { atomic.AddInt32(&p.running, -1) } @@ -215,7 +215,7 @@ func (p *Pool) getWorker() *Worker { task: make(chan f, 1), } w.run() - p.IncrRunning() + p.incrRunning() } return w } diff --git a/pool_func.go b/pool_func.go index 77221e4..c672bd2 100644 --- a/pool_func.go +++ b/pool_func.go @@ -134,13 +134,13 @@ func (p *PoolWithFunc) Running() int { return int(atomic.LoadInt32(&p.running)) } -// IncrRunning increases the number of the currently running goroutines -func (p *PoolWithFunc) IncrRunning() { +// incrRunning increases the number of the currently running goroutines +func (p *PoolWithFunc) incrRunning() { atomic.AddInt32(&p.running, 1) } -// DecrRunning decreases the number of the currently running goroutines -func (p *PoolWithFunc) DecrRunning() { +// decrRunning decreases the number of the currently running goroutines +func (p *PoolWithFunc) decrRunning() { atomic.AddInt32(&p.running, -1) } @@ -220,7 +220,7 @@ func (p *PoolWithFunc) getWorker() *WorkerWithFunc { args: make(chan interface{}, 1), } w.run() - p.IncrRunning() + p.incrRunning() } return w } diff --git a/worker.go b/worker.go index 8d29a3a..aa4e761 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.decrRunning() return } f() diff --git a/worker_func.go b/worker_func.go index 22b6069..277ee31 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.decrRunning() return } w.pool.poolFunc(args)