mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-28 13:33:10 +00:00
rm a redundant creation of goroutines (#179)
Co-authored-by: husyhu <husyhu@qq.com>
This commit is contained in:
+9
-11
@@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user