Skip to content

Commit 1768bc5

Browse files
committed
fixup! Set threadpool for foreign and utility to :unassociated
1 parent 1692a0b commit 1768bc5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

base/partr.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ end
8888

8989
function multiq_insert(task::Task, priority::UInt16)
9090
tpid = ccall(:jl_get_task_threadpoolid, Int8, (Any,), task)
91+
@assert tpid > -1
9192
heap_p = multiq_size(tpid)
9293
tp = tpid + 1
9394

base/threadingconstructs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function threading_run(fun, static)
159159
else
160160
# TODO: this should be the current pool (except interactive) if there
161161
# are ever more than two pools.
162-
ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default))
162+
@assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default)) == 1
163163
end
164164
tasks[i] = t
165165
schedule(t)
@@ -369,7 +369,7 @@ function _spawn_set_thrpool(t::Task, tp::Symbol)
369369
if tpid == -1 || _nthreads_in_pool(tpid) == 0
370370
tpid = _sym_to_tpid(:default)
371371
end
372-
ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid)
372+
@assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid) == 1
373373
nothing
374374
end
375375

src/partr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ JL_DLLEXPORT int jl_set_task_tid(jl_task_t *task, int16_t tid) JL_NOTSAFEPOINT
7070

7171
JL_DLLEXPORT int jl_set_task_threadpoolid(jl_task_t *task, int8_t tpid) JL_NOTSAFEPOINT
7272
{
73-
if (tpid < 0 || tpid >= jl_n_threadpools)
73+
if (tpid < -1 || tpid >= jl_n_threadpools)
7474
return 0;
7575
task->threadpoolid = tpid;
7676
return 1;

0 commit comments

Comments
 (0)