Skip to content

Commit 02a7c4d

Browse files
vtjnashJeffBezanson
authored andcommitted
threading: support more than nthreads at runtime
Hook a couple functions (notably cfunction) to handle adopting foreign threads automatically when used. n.b. If returning an object pointer, we do not gc_unsafe_leave afterwards as that would render the pointer invalid. However, this means that it can be a long time before the next safepoint (if ever). We should look into ways of improving this bad situation, such as pinning only that specific object temporarily. n.b. There are some remaining issues to clean up. For example, we may trap pages in the ptls after GC to keep them "warm", and trap other pages in the unwind buffer, etc.
1 parent c297457 commit 02a7c4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/distributed_exec.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ function _getenv_include_thread_unsafe()
153153
end
154154
const _env_include_thread_unsafe = _getenv_include_thread_unsafe()
155155
function include_thread_unsafe_tests()
156-
if Threads.nthreads() > 1
156+
if Threads.maxthreadid() > 1
157157
if _env_include_thread_unsafe
158158
return true
159159
end
160-
msg = "Skipping a thread-unsafe test because `Threads.nthreads() > 1`"
161-
@warn msg Threads.nthreads()
160+
msg = "Skipping a thread-unsafe test because `Threads.maxthreadid() > 1`"
161+
@warn msg Threads.maxthreadid()
162162
Test.@test_broken false
163163
return false
164164
end

0 commit comments

Comments
 (0)