Skip to content

Commit 5c4ff3f

Browse files
committed
Document how to handle kill/terminate interrupts in Thread.handle_interrupt
The kill/terminate interrupts are internally handled not as Exception instances, but as integers. So using Exception doesn't handle these interrupts, but Object does. You can use Integer if you only want to handle kill/terminate interrupts, but that's probably more of an implementation detail, while handling Object should work regardless of the implementation. Fixes [Bug #15735]
1 parent 0395aa6 commit 5c4ff3f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

thread.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,6 +2223,8 @@ handle_interrupt_arg_check_i(VALUE key, VALUE val, VALUE args)
22232223
* # all exceptions inherited from Exception are prohibited.
22242224
* }
22252225
*
2226+
* For handling all interrupts, use +Object+ and not +Exception+
2227+
* as the ExceptionClass, as kill/terminate interrupts are not handled by +Exception+.
22262228
*/
22272229
static VALUE
22282230
rb_thread_s_handle_interrupt(VALUE self, VALUE mask_arg)

0 commit comments

Comments
 (0)