Last active
July 18, 2018 16:39
-
-
Save dmora/1e6a51d94dbf24dfe6d321b9cd4b956f 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
// 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