From 15507b021f908a9ee1b8d1619e17f4c1764dc548 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sat, 2 Feb 2019 10:24:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Support=20not=20only=20anonymous?= =?UTF-8?q?=20but=20also=20explicit=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pool.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pool.go b/pool.go index 3eca571..a6efb03 100644 --- a/pool.go +++ b/pool.go @@ -28,8 +28,6 @@ import ( "time" ) -type f func() - // Pool accept the tasks from client,it limits the total // of goroutines to a given number by recycling goroutines. type Pool struct { @@ -123,7 +121,7 @@ func NewTimingPool(size, expiry int) (*Pool, error) { //--------------------------------------------------------------------------- // Submit submits a task to this pool. -func (p *Pool) Submit(task f) error { +func (p *Pool) Submit(task func()) error { if 1 == atomic.LoadInt32(&p.release) { return ErrPoolClosed } @@ -205,7 +203,7 @@ func (p *Pool) retrieveWorker() *Worker { } else { w = &Worker{ pool: p, - task: make(chan f, workerChanCap), + task: make(chan func(), workerChanCap), } } w.run()