Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tasks: create taskResult to be returned by Drain
Before this patch, the workerpool would keep a reference to the task struct even after its task func it has completed to provide the resulting error (if any) when Drain() is called. Since the task struct has a reference to the user-provided provided task func, the task func cannot be garbage collected until Drain() is called. This could be problematic as (1) the number of task is unbounded and (2) the workerpool has no control over the memory used by the task func. This patch introduce a taskResult struct satisfying the Task interface that doesn't keep a reference to the task func. Signed-off-by: Alexandre Perrin <[email protected]>
- Loading branch information