We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12698af commit 0012980Copy full SHA for 0012980
base/threadingconstructs.jl
@@ -35,6 +35,19 @@ julia> Threads.threadid(Threads.@spawn "foo")
35
"""
36
threadid() = Int(ccall(:jl_threadid, Int16, ())+1)
37
38
+"""
39
+ Threads.threadpool_threadidx() -> Int
40
+
41
+Return the index of the current thread in its threadpool.
42
+i.e. For the first default thread when 1 interactive thread exists this returns 1
43
+because the interactive threadpool comes first in threadid order.
44
45
+function threadpool_threadidx()
46
+ pool = threadpool()
47
+ first_tid = first(threadpooltids(pool))
48
+ return Int(threadid() - first_tid + 1)
49
+end
50
51
# lower bound on the largest threadid()
52
53
Threads.maxthreadid() -> Int
0 commit comments