Skip to content

Commit 08b5cd0

Browse files
authored
Merge pull request #566 from JuliaParallel/cancel-after-shutdown
Make Dagger.cancel!() handle a shutting down/shutdown scheduler
2 parents 557269d + a4f6470 commit 08b5cd0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: src/cancellation.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ function cancel!(tid::Union{Int,Nothing}=nothing;
3131
force::Bool=false, halt_sch::Bool=false)
3232
remotecall_fetch(1, tid, force, halt_sch) do tid, force, halt_sch
3333
state = Sch.EAGER_STATE[]
34-
state === nothing && return
35-
@lock state.lock _cancel!(state, tid, force, halt_sch)
34+
35+
# Check that the scheduler isn't stopping or has already stopped
36+
if !isnothing(state) && !state.halt.set
37+
@lock state.lock _cancel!(state, tid, force, halt_sch)
38+
end
3639
end
3740
end
3841
function _cancel!(state, tid, force, halt_sch)

0 commit comments

Comments
 (0)