Skip to content

Commit 42e2a32

Browse files
authored
Merge pull request #553 from JuliaParallel/jps/dtask-sync-fix
@Spawn: Properly rethrow in @sync
2 parents 7e2707b + c69dfc2 commit 42e2a32

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: src/thunk.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function _par(ex::Expr; lazy=true, recur=true, opts=())
402402
let
403403
$result = $spawn($f, $Options(;$(opts...)), $(args...); $(kwargs...))
404404
if $(Expr(:islocal, sync_var))
405-
put!($sync_var, schedule(Task(()->wait($result))))
405+
put!($sync_var, schedule(Task(()->fetch($result; raw=true))))
406406
end
407407
$result
408408
end

Diff for: test/thunk.jl

+4
Original file line numberDiff line numberDiff line change
@@ -348,5 +348,9 @@ end
348348
result = Dagger.@spawn sleep(1)
349349
end
350350
@test isready(result)
351+
352+
@test_throws Exception @sync begin
353+
Dagger.@spawn error()
354+
end
351355
end
352356
end

0 commit comments

Comments
 (0)