From: merch-redmine@... Date: 2021-04-08T15:11:29+00:00 Subject: [ruby-core:103306] [Ruby master Bug#15735] Thread#handle_interrupt does not prevent Thread#kill from interrupting Issue #15735 has been updated by jeremyevans0 (Jeremy Evans). I've determined this is just a documentation issue, and there is a way for `Thread.handle_interrupt` to handle kill/terminate interrupts, which I've committed. If we handle to allow `Exception` to include these interrupts, we could do something like this: ```diff --- a/thread.c +++ b/thread.c @@ -1992,6 +1992,7 @@ rb_threadptr_pending_interrupt_check_mask(rb_thread_t *th, VALUE err) VALUE mod; long i; + retry: for (i=0; i :never)` would prevent the interrupts from `Thread#kill`. In the following code, however, the `Thread#kill` seems to just kill the thread immediately even if the thread is instructed to never handle interrupt. ``` ruby t = Thread.new do Thread.handle_interrupt(Exception => :never) do puts "thread started" sleep 2 puts "thread end" end end sleep 1 t.kill puts "main end" sleep 2 ``` Outputs ``` $ ruby test.rb thread started main end $ ``` Is the document wrong? Or, implementation not working as expected? -- https://bugs.ruby-lang.org/ Unsubscribe: