Skip to content

Commit 8430749

Browse files
Husyhusy-dev
Husy
andauthoredFeb 17, 2023
rm a redundant creation of goroutines (#179)
Co-authored-by: husyhu <[email protected]>
1 parent 15f3f6d commit 8430749

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed
 

‎pool/fixpool.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,14 @@ func (p *WorkerPool) dispatch() {
4343
}
4444

4545
func startWorker(taskChan chan func()) {
46-
go func() {
47-
var task func()
48-
var ok bool
49-
for {
50-
task, ok = <-taskChan
51-
if !ok {
52-
break
53-
}
54-
// Execute the task.
55-
task()
46+
var task func()
47+
var ok bool
48+
for {
49+
task, ok = <-taskChan
50+
if !ok {
51+
break
5652
}
57-
}()
53+
// Execute the task.
54+
task()
55+
}
5856
}

0 commit comments

Comments
 (0)
Please sign in to comment.