gobwas/ws-examples

Find task in pool question

Opened this issue · 0 comments

Hi , I read this part fo code
func (p *Pool) worker(task func()) {
defer func() { <-p.sem }()

**task()**

**for task := range p.work {
	**task()**
}**

}
question :

  1. why not just use range p.work do task() ?
  2. Do task() before that("range p.work") is essential?
    Thank you