Worker Pool
Hard · Concurrency
A worker pool runs workers goroutines that read jobs from a channel, call fn(job), and send the result. Close the jobs channel to stop. Collect every result.
Write Pool(nWorkers, jobs, fn) that returns the results in any order. RunPool(workers, nums) squares each number via the pool and returns them sorted.
Next: Select with Timeout