ivpusic / grpool

Lightweight Goroutine pool

Home Page:https://godoc.org/github.com/ivpusic/grpool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I send param to workpool?

JackTiger opened this issue · comments

directly not, but you can use closures

  for i := 0; i < 10; i++ {
    count := i

    pool.JobQueue <- func() {
      fmt.Printf("I am worker! Number %d\n", count)
    }
  }