Skip to content

Instantly share code, notes, and snippets.

@dmora
Last active July 18, 2018 16:38
Show Gist options
  • Save dmora/ce8c2a62faff99f1cf18015beec3077c to your computer and use it in GitHub Desktop.
Save dmora/ce8c2a62faff99f1cf18015beec3077c to your computer and use it in GitHub Desktop.
// work performs the actual work by calling the processor and passing in the Job as reference obtained
// from iterating over the "Jobs" channel
func (m *Manager) work(wg *sync.WaitGroup, processor ProcessorFunc) {
defer wg.Done()
for job := range m.jobs {
output := Result{job, processor(job.resource)}
m.results <- output
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment