Created
July 19, 2018 20:53
-
-
Save dmora/9ad12900b2d4f35d72b3bc80dfc66397 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
// Start starts the worker pool process | |
func (m *Pool) Start(resources []interface{}, procFunc ProcessorFunc, resFunc ResultProcessorFunc) { | |
log.DEBUG.Print("worker pool starting") | |
startTime := time.Now() | |
go m.allocate(resources) | |
m.done = make(chan bool) | |
go m.collect(resFunc) | |
go m.workerPool(procFunc) | |
<-m.done | |
endTime := time.Now() | |
diff := endTime.Sub(startTime) | |
log.DEBUG.Printf("total time taken: [%f] seconds", diff.Seconds()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment