@@ -60,8 +60,8 @@ Fields:
60
60
- `worker_chans::Dict{Int, Tuple{RemoteChannel,RemoteChannel}}` - Communication channels between the scheduler and each worker
61
61
- `procs_cache_list::Base.RefValue{Union{ProcessorCacheEntry,Nothing}}` - Cached linked list of processors ready to be used
62
62
- `function_cost_cache::Dict{Type{<:Tuple},UInt}` - Cache of estimated CPU time required to compute the given signature
63
- - `halt::Base.RefValue{Bool} ` - Flag indicating, when set, that the scheduler should halt immediately
64
- - `lock::ReentrantLock() ` - Lock around operations which modify the state
63
+ - `halt::Base.Event ` - Event indicating that the scheduler is halting
64
+ - `lock::ReentrantLock` - Lock around operations which modify the state
65
65
- `futures::Dict{Thunk, Vector{ThunkFuture}}` - Futures registered for waiting on the result of a thunk.
66
66
- `errored::Set{Thunk}` - Thunks that threw an error
67
67
- `chan::RemoteChannel{Channel{Any}}` - Channel for receiving completed thunks
@@ -84,7 +84,7 @@ struct ComputeState
84
84
worker_chans:: Dict{Int, Tuple{RemoteChannel,RemoteChannel}}
85
85
procs_cache_list:: Base.RefValue{Union{ProcessorCacheEntry,Nothing}}
86
86
function_cost_cache:: Dict{Type{<:Tuple},UInt}
87
- halt:: Base.RefValue{Bool}
87
+ halt:: Base.Event
88
88
lock:: ReentrantLock
89
89
futures:: Dict{Thunk, Vector{ThunkFuture}}
90
90
errored:: Set{Thunk}
@@ -109,7 +109,7 @@ function start_state(deps::Dict, node_order, chan)
109
109
Dict {Int, Tuple{RemoteChannel,RemoteChannel}} (),
110
110
Ref {Union{ProcessorCacheEntry,Nothing}} (nothing ),
111
111
Dict {Type{<:Tuple},UInt} (),
112
- Ref {Bool} ( false ),
112
+ Base . Event ( ),
113
113
ReentrantLock (),
114
114
Dict {Thunk, Vector{ThunkFuture}} (),
115
115
Set {Thunk} (),
@@ -441,7 +441,9 @@ function compute_dag(ctx, d::Thunk; options=SchedulerOptions())
441
441
442
442
safepoint (state)
443
443
end
444
- state. halt[] = true
444
+ @assert ! isready (state. chan)
445
+ close (state. chan)
446
+ notify (state. halt)
445
447
@sync for p in procs_to_use (ctx)
446
448
@async cleanup_proc (state, p)
447
449
end
0 commit comments