From e22d308e17e607a1190ae1ce47e2e8a2333dc75c Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 9 Aug 2023 16:45:28 -0400 Subject: [PATCH] fix #50438, use default pool for at-threads (#50845) (cherry picked from commit 744aa79c2c2655de526f02dcd1987ae1d7db6f6d) --- base/threadingconstructs.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/threadingconstructs.jl b/base/threadingconstructs.jl index e4f14e26ac5a9..7a70132a9dccc 100644 --- a/base/threadingconstructs.jl +++ b/base/threadingconstructs.jl @@ -146,7 +146,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