cancel method
Task cancelation. If a specific task
is provided, only this task will be canceled.
Otherwise, all tasks registered with the WorkerPool
are canceled.
Implementation
void cancel(Task task, [String? message]) {
_executing.remove(task);
_queue.removeWhere((t) => t == task);
task.cancel(message);
}