Created
July 19, 2018 22:31
-
-
Save dmora/0e4ccdef90c6f5931cfe6491898d705e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 *Pool) work(wg *sync.WaitGroup, processor ProcessorFunc) { | |
defer wg.Done() | |
log.DEBUG.Print("goRoutine work starting") | |
for job := range m.jobs { | |
log.DEBUG.Printf("working on Job ID [%d]", job.id) | |
output := Result{job, processor(job.resource)} | |
m.results <- output | |
log.DEBUG.Printf("done with Job ID [%d]", job.id) | |
} | |
log.DEBUG.Print("goRoutine work done.") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment