Skip to content

Commit 9a33b53

Browse files
committed
Remove task stickiness check/spread in _wait2(t1, t2)
1 parent e221522 commit 9a33b53

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

base/task.jl

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,12 @@ end
318318
function _wait2(t::Task, waiter::Task)
319319
if !istaskdone(t)
320320
lock(t.donenotify)
321-
if !istaskdone(t)
322-
push!(t.donenotify.waitq, waiter)
323-
unlock(t.donenotify)
324-
# since _wait2 is similar to schedule, we should observe the sticky
325-
# bit, even if we aren't calling `schedule` due to this early-return
326-
if waiter.sticky && Threads.threadid(waiter) == 0 && !GC.in_finalizer()
327-
# Issue #41324
328-
# t.sticky && tid == 0 is a task that needs to be co-scheduled with
329-
# the parent task. If the parent (current_task) is not sticky we must
330-
# set it to be sticky.
331-
# XXX: Ideally we would be able to unset this
332-
current_task().sticky = true
333-
tid = Threads.threadid()
334-
ccall(:jl_set_task_tid, Cint, (Any, Cint), waiter, tid-1)
321+
try
322+
if !istaskdone(t)
323+
push!(t.donenotify.waitq, waiter)
324+
return nothing
335325
end
336-
return nothing
337-
else
326+
finally
338327
unlock(t.donenotify)
339328
end
340329
end

0 commit comments

Comments
 (0)