Skip to content

Commit

Permalink
Merge pull request #43742 from dnadlinger/fix-set-task-tid-return
Browse files Browse the repository at this point in the history
Align ccall() jl_set_task_tid return type with C declaration [nfc]
  • Loading branch information
vchuravy committed Jan 10, 2022
2 parents 7b62896 + 85d141f commit c883dbd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function _wait2(c::GenericCondition, waiter::Task)
# XXX: Ideally we would be able to unset this
ct.sticky = true
tid = Threads.threadid()
ccall(:jl_set_task_tid, Cvoid, (Any, Cint), waiter, tid-1)
ccall(:jl_set_task_tid, Cint, (Any, Cint), waiter, tid-1)
end
return
end
Expand Down
6 changes: 3 additions & 3 deletions base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function _wait2(t::Task, waiter::Task)
# XXX: Ideally we would be able to unset this
current_task().sticky = true
tid = Threads.threadid()
ccall(:jl_set_task_tid, Cvoid, (Any, Cint), waiter, tid-1)
ccall(:jl_set_task_tid, Cint, (Any, Cint), waiter, tid-1)
end
return nothing
else
Expand Down Expand Up @@ -694,15 +694,15 @@ function enq_work(t::Task)
# XXX: Ideally we would be able to unset this
current_task().sticky = true
tid = Threads.threadid()
ccall(:jl_set_task_tid, Cvoid, (Any, Cint), t, tid-1)
ccall(:jl_set_task_tid, Cint, (Any, Cint), t, tid-1)
end
push!(Workqueues[tid], t)
else
if ccall(:jl_enqueue_task, Cint, (Any,), t) != 0
# if multiq is full, give to a random thread (TODO fix)
if tid == 0
tid = mod(time_ns() % Int, Threads.nthreads()) + 1
ccall(:jl_set_task_tid, Cvoid, (Any, Cint), t, tid-1)
ccall(:jl_set_task_tid, Cint, (Any, Cint), t, tid-1)
end
push!(Workqueues[tid], t)
else
Expand Down
2 changes: 1 addition & 1 deletion base/threadingconstructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function threading_run(func)
for i = 1:n
t = Task(func)
t.sticky = true
ccall(:jl_set_task_tid, Cvoid, (Any, Cint), t, i-1)
ccall(:jl_set_task_tid, Cint, (Any, Cint), t, i-1)
tasks[i] = t
schedule(t)
end
Expand Down

0 comments on commit c883dbd

Please sign in to comment.