-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
multithreadingBase.Threads and related functionalityBase.Threads and related functionality
Description
We are probably noticing the absence of a threadpool here, and so making the new Task sticky, but there is the main task (1) which is also considered a background worker thread:
$ ./julia -t1 -q
julia> threadwork = @cfunction ()->(Threads.@spawn println(Threads.threadid(), " ", current_task().rngState0, " ", current_task().rngState1, " ", current_task().rngState2, " ", current_task().rngState3); Cint(0)) Cint ()
Ptr{Nothing} @0x000000010a7341f0
julia> tid = UInt[0]; @ccall pthread_create(tid::Ptr{UInt}, C_NULL::Ptr{Cvoid}, threadwork::Ptr{Cvoid}, C_NULL::Ptr{Cvoid})::Cint; @ccall pthread_join(tid[]::UInt, C_NULL::Ptr{Cvoid})::Cint
0
julia> Base.Workqueues
2-element Vector{Base.IntrusiveLinkedListSynchronized{Task}}:
Base.IntrusiveLinkedListSynchronized{Task}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0))
Base.IntrusiveLinkedListSynchronized{Task}(Base.IntrusiveLinkedList{Task}(Task (runnable) @0x0000000106fc8160, Task (runnable) @0x0000000106fc8160), Base.Threads.SpinLock(0))This snippet works if we launch with -t2 or greater
Metadata
Metadata
Assignees
Labels
multithreadingBase.Threads and related functionalityBase.Threads and related functionality