Skip to content

Commit 1692a0b

Browse files
vchuravygbaraldi
andcommitted
Don't taint parent thread of at_threads with sticky
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
1 parent d78ea59 commit 1692a0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

base/threadingconstructs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ function threading_run(fun, static)
149149
n = threadpoolsize()
150150
tid_offset = threadpoolsize(:interactive)
151151
tasks = Vector{Task}(undef, n)
152+
ct = current_task()
153+
ct_static = ct.static
152154
for i = 1:n
153155
t = Task(() -> fun(i)) # pass in tid
154156
t.sticky = static
@@ -162,6 +164,7 @@ function threading_run(fun, static)
162164
tasks[i] = t
163165
schedule(t)
164166
end
167+
ct.static = ct_static
165168
for i = 1:n
166169
Base._wait(tasks[i])
167170
end

0 commit comments

Comments
 (0)