diff --git a/base/threadingconstructs.jl b/base/threadingconstructs.jl index a802aac5a4745..2c04c3171d5c2 100644 --- a/base/threadingconstructs.jl +++ b/base/threadingconstructs.jl @@ -138,7 +138,13 @@ function threading_run(fun, static) for i = 1:n t = Task(() -> fun(i)) # pass in tid t.sticky = static - static && ccall(:jl_set_task_tid, Cint, (Any, Cint), t, tid_offset + i-1) + if static + ccall(:jl_set_task_tid, Cint, (Any, Cint), t, tid_offset + i-1) + else + # TODO: this should be the current pool (except interactive) if there + # are ever more than two pools. + ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default)) + end tasks[i] = t schedule(t) end