Setting and getting the current ref tracer should be done while all the threads are stopped to avoid races. This is because users cannot ever safely free the old ref tracer's user data in a free threaded build, because is not possible to ever be sure that no other thread is in the middle of calling the ref tracer. Without synchronizing across threads there, one thread can still be trying to use the old tracer while another thinks it has been successfully uninstalled and safe to clean up
Linked PRs