ws-examples icon indicating copy to clipboard operation
ws-examples copied to clipboard

Find task in pool question

Open CJayKao opened this issue 6 years ago • 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

CJayKao avatar Aug 12 '19 06:08 CJayKao