Skip to content

Commit 2a73e68

Browse files
MasonProtterDrvi
authored andcommitted
Try to fix incorrect documentation of nthreads (JuliaLang#53117)
Since JuliaLang#49094, the docstring of `nthreads` has been incorrect. It currently states that > The threads in default have id numbers `1:nthreads(:default)`. whereas that is no longer true: ```julia julia> filter(i -> Threads.threadpool(i) == :interactive, 1:Threads.maxthreadid()) 3-element Vector{Int64}: 1 2 3 julia> filter(i -> Threads.threadpool(i) == :default, 1:Threads.maxthreadid()) 6-element Vector{Int64}: 4 5 6 7 8 9 ``` (cherry picked from commit 95ae27f)
1 parent ed8938e commit 2a73e68

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/threadingconstructs.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ maxthreadid() = Int(Core.Intrinsics.atomic_pointerref(cglobal(:jl_n_threads, Cin
4444
"""
4545
Threads.nthreads(:default | :interactive) -> Int
4646
47-
Get the current number of threads within the specified thread pool. The threads in default
48-
have id numbers `1:nthreads(:default)`.
47+
Get the current number of threads within the specified thread pool. The threads in `:interactive`
48+
have id numbers `1:nthreads(:interactive)`, and the threads in `:default` have id numbers in
49+
`nthreads(:interactive) .+ (1:nthreads(:default))`.
4950
5051
See also `BLAS.get_num_threads` and `BLAS.set_num_threads` in the [`LinearAlgebra`](@ref
5152
man-linalg) standard library, and `nprocs()` in the [`Distributed`](@ref man-distributed)

0 commit comments

Comments
 (0)