We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a1ee90 commit 024b0b7Copy full SHA for 024b0b7
2 files changed
chapter7/patterns/pool/pool.go
@@ -92,7 +92,7 @@ func (p *Pool) Close() {
92
return
93
}
94
95
- // Toggle the flag
+ // Set the pool as closed.
96
p.closed = true
97
98
// Close the channel before we drain the channel of its
chapter7/patterns/work/work.go
@@ -20,13 +20,13 @@ type Pool struct {
20
21
22
// New creates a new work pool.
23
-func New(goroutines int) *Pool {
+func New(maxGoroutines int) *Pool {
24
p := Pool{
25
work: make(chan Worker),
26
27
28
- p.wg.Add(goroutines)
29
- for i := 0; i < goroutines; i++ {
+ p.wg.Add(maxGoroutines)
+ for i := 0; i < maxGoroutines; i++ {
30
go func() {
31
for w := range p.work {
32
w.Task()
0 commit comments