Follow up to #14554 where a comment by @yxhuvud made me realize that Thread#start wasn't exactly GC safe, in that a GC collection could happen in parallel to a thread starting and it could free the Thread object before the thread is started or before the thread is properly shutdown.
The patch mostly moves the calls to add/remove the thread object from the linked list, along with some explanations.
Note: only the last commit is relevant, the rest is from #14554.
Follow up to #14554 where a comment by @yxhuvud made me realize that
Thread#start
wasn't exactly GC safe, in that a GC collection could happen in parallel to a thread starting and it could free the Thread object before the thread is started or before the thread is properly shutdown.The patch mostly moves the calls to add/remove the thread object from the linked list, along with some explanations.
Note: only the last commit is relevant, the rest is from #14554.