Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,14 @@ end
# just wait for a task to be done, no error propagation
function _wait(t::Task)
if !istaskdone(t)
lock(t.donenotify)
donenotify = t.donenotify::ThreadSynchronizer
lock(donenotify)
try
while !istaskdone(t)
wait(t.donenotify)
wait(donenotify)
end
finally
unlock(t.donenotify)
unlock(donenotify)
end
end
nothing
Expand All @@ -330,13 +331,14 @@ function _wait2(t::Task, waiter::Task)
tid = Threads.threadid()
ccall(:jl_set_task_tid, Cint, (Any, Cint), waiter, tid-1)
end
lock(t.donenotify)
donenotify = t.donenotify::ThreadSynchronizer
lock(donenotify)
if !istaskdone(t)
push!(t.donenotify.waitq, waiter)
unlock(t.donenotify)
push!(donenotify.waitq, waiter)
unlock(donenotify)
return nothing
else
unlock(t.donenotify)
unlock(donenotify)
end
end
schedule(waiter)
Expand Down