rm a redundant creation of goroutines (#179)

Co-authored-by: husyhu <husyhu@qq.com>
This commit is contained in:
Husy
2023-02-17 17:01:16 +08:00
committed by GitHub
co-authored by husyhu
parent 15f3f6d52e
commit 8430749ec4
+9 -11
View File
@@ -43,16 +43,14 @@ func (p *WorkerPool) dispatch() {
} }
func startWorker(taskChan chan func()) { func startWorker(taskChan chan func()) {
go func() { var task func()
var task func() var ok bool
var ok bool for {
for { task, ok = <-taskChan
task, ok = <-taskChan if !ok {
if !ok { break
break
}
// Execute the task.
task()
} }
}() // Execute the task.
task()
}
} }