Skip to content

Commit

Permalink
Update nthreads(pool)
Browse files Browse the repository at this point in the history
Now returns `threadpoolsize(pool)`.
  • Loading branch information
kpamnany committed Mar 6, 2023
1 parent dc68ffc commit 944dce9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions base/threadingconstructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,7 @@ See also `BLAS.get_num_threads` and `BLAS.set_num_threads` in the [`LinearAlgebr
man-linalg) standard library, and `nprocs()` in the [`Distributed`](@ref man-distributed)
standard library and [`Threads.maxthreadid()`](@ref).
"""
function nthreads(pool::Symbol)
if pool === :default
tpid = Int8(0)
elseif pool === :interactive
tpid = Int8(1)
else
error("invalid threadpool specified")
end
return _nthreads_in_pool(tpid)
end
nthreads(pool::Symbol) = threadpoolsize(pool)

function _nthreads_in_pool(tpid::Int8)
p = unsafe_load(cglobal(:jl_n_threads_per_pool, Ptr{Cint}))
Expand Down

0 comments on commit 944dce9

Please sign in to comment.