()
| 146 | } |
| 147 | |
| 148 | func (p *Pool) worker() { |
| 149 | // The only time this matters is if the task panics. |
| 150 | // This makes it possible to spin up new workers in that case. |
| 151 | defer p.limiter.release() |
| 152 | |
| 153 | for f := range p.tasks { |
| 154 | f() |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | type limiter chan struct{} |
| 159 |