Open ioquatix opened 10 months ago
I'm sure I understand how this would be used to make a barrier fail fast in case a task fail, as discussed in #272.
Is the idea that all tasks in the barrier would use the same condition to signal when they are done, so that the barrier will be notified when a task finish, and potentially fail fast? I think that would have the side effect that if some other code wait for a particular task in the barrier, then that wait would end whenever any task in the barrier finishes?
However, it's not clear how to close the queue to indicate no more jobs will be added.
What about a drain
method, which works like each
, except it returns as soon as the queue is empty?
What about a
drain
method, which works likeeach
, except it returns as soon as the queue is empty?
To clarify - this would imply that tasks are added to the queue when created, and are removed when they finish. drain
would yield each task as they complete, returning when there is no more items.
The current PR works differently: it adds task to the queue only when finished. each
waits for new items to be added, which are then removed and yielded. It never returns.
I have not had time to revisit this yet, but I will in the coming week.
However, it's not clear how to close the queue to indicate no more jobs will be added.