PQueue with synchronous
add and a common error-handler.
Construct the queue.
Common error handler for all the tasks, it is called whenever a task errors. The first parameter is an error object. The second parameter, if called, would re-add the task to the queue again. Useful if you know an error indicates another attempt to execute the task is necessary.
Size of the queue. Counts both deferred and currently running tasks.
Add task to queue. Fire-and-forget semantics.
Clear the queue.
Wait till all the tasks are completed.
Add task and wait till it is completed.
The point of
run (as opposed to
add) is to pass an error to the caller if it is throw inside a task.
Note "fire-and-forget" comment for the