By default, @sync
will collect all the exceptions in its block and throw them after everything is done. However, I have a code looking like
@sync begin
@async for i in 1:1000
# task A
end
@async for i in 1:1000
# task B
end
end
In my case, if task B failed, task A will be blocked and @sync
will wait for ever.
Is there a version of @sync
such that an exception is immediately thrown if one of the task it encloses failed?