Skip to content

Instantly share code, notes, and snippets.

@dmora
Last active July 18, 2018 16:39
Show Gist options
  • Save dmora/1e6a51d94dbf24dfe6d321b9cd4b956f to your computer and use it in GitHub Desktop.
Save dmora/1e6a51d94dbf24dfe6d321b9cd4b956f to your computer and use it in GitHub Desktop.
// workerPool creates or spawns new "work" goRoutines to process the "Jobs" channel
func (m *Manager) workerPool(processor ProcessorFunc) {
defer close(m.results)
var wg sync.WaitGroup
for i := 0; i < m.numRoutines; i++ {
wg.Add(1)
go m.work(&wg, processor)
}
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment