Foreign threads: improve handling of adoption during GC #49960
Labels
feature
Indicates new feature / enhancement requests
multithreading
Base.Threads and related functionality
#49928 shows that thread adoption (
jl_adopt_thread
) during GC execution causes segmentation faults, because it hits safepoints before the necessary signal handlers are installed. A workaround was merged in #49934, which makes thread adoption wait until GC finishes, and disables it until the thread is fully set-up.That workaround isn't great. It would be better if
jl_adopt_thread
installs signal handlers earlier, so that it can use the regular safepoint mechanism instead of having to spin (necessitating changes to safepoint handling, see https://github.com/JuliaLang/julia/pull/49934/files#diff-bee600bf97e7c6c270d5ee24948080e9e92ba903b34c76e6c2d34b18bc3771ba). As noted in #49934, that isn't straightforward, and some functionality will have to be split off / made compatible with execution during task set-up.The text was updated successfully, but these errors were encountered: