Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
always spawn a worker with the task it was supposed to complete (#112)
For "unlimited" pools, in the original code: ```go p.handle.Go(p.worker) p.tasks <- f ``` If in between the call to `handle.Go` and sending the task to the worker, another goroutine would call `pool.Go`, that task would "hijack" the newly created worker, causing the original send to block. This is undesirable behavior if the pool is unlimited. The solution was to add an `initialFunc` to the worker, which will be executed before the worker starts waiting for new tasks. This ensures that a worker will first complete the task it was supposed to, then complete others.
- Loading branch information