Fix worker termination handling

Fixes issue #102.
This commit is contained in:
kortschak 2014-08-26 14:20:37 +09:30
parent 62e7037f20
commit 73dbfc9461
3 changed files with 26 additions and 37 deletions

View file

@ -251,11 +251,8 @@ func (wk *worker) send(r *Result) bool {
if wk.limit >= 0 && wk.limit == wk.count {
return false
}
wk.envLock.Lock()
kill := wk.kill
wk.envLock.Unlock()
select {
case <-kill:
case <-wk.kill:
return false
default:
}