Push signal traps and at_exit blocks to a common thread for exec. #5441
This avoids races due to the signal traps running on the JVM's signal-handling thread while we run at_exit blocks on JRuby's main thread. Fixes #5437.
I can recreate something later today if it doesn't.
EDIT: Added the code.
@Adithya-copart Ah yes, that's quite similar to how this PR works, except that we use a JDK "ExecutorService" that manages the native thread and queueing for us.
I will try to reproduce based on your instructions.
There are failures in CI, unfortunately. It seems that at least the CRuby/MRI tests expect
I'm not sure we want to emulate that behavior.
I have a thought for a modification to my fix that just waits for all scheduled signal handlers to execute before proceeding on to the