Simple parallel processing utilities for Go.
See the API documentation for more details.
This software is made available under an MIT license.
Split processing of a large number of things across eight workers:
var thingsToProcess []Thing
parallel.RunWorkers(8, func(workerNum, workerCount int) {
for i := workerNum; i < len(thingsToProcess); i += workerCount {
processThing(thingsToProcess[i])
}
})
RunWorkers
returns when all workers have run to completion, allowing a task to be performed in parallel but treated more simply as a synchronous call.