optimize worker queue

This commit is contained in:
Andy Pan 2018-05-19 12:36:28 +08:00
parent e683ddc821
commit 7bf85c2a66
1 changed files with 1 additions and 0 deletions

View File

@ -14,6 +14,7 @@ func (w *Worker) run() {
select { select {
case f := <-w.task: case f := <-w.task:
f() f()
w.pool.workers <- w
case <-w.exit: case <-w.exit:
atomic.AddInt32(&w.pool.length, -1) atomic.AddInt32(&w.pool.length, -1)
return return