[#103241] [Ruby master Bug#17777] 2.6.7 fails to build on macOS: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99 — eregontp@...
Issue #17777 has been reported by Eregon (Benoit Daloze).
17 messages
2021/04/05
[#103305] [Ruby master Feature#17785] Allow named parameters to be keywords — marcandre-ruby-core@...
Issue #17785 has been reported by marcandre (Marc-Andre Lafortune).
21 messages
2021/04/08
[#103342] [Ruby master Feature#17790] Have a way to clear a String without resetting its capacity — jean.boussier@...
Issue #17790 has been reported by byroot (Jean Boussier).
14 messages
2021/04/09
[#103388] [ANN] Multi-factor Authentication of bugs.ruby-lang.org — SHIBATA Hiroshi <hsbt@...>
Hello,
5 messages
2021/04/12
[#103414] Re: [ANN] Multi-factor Authentication of bugs.ruby-lang.org
— Martin J. Dürst <duerst@...>
2021/04/13
Is there a way to use this multi-factor authentication for (like me)
[#103547] List of CI sites to check — Martin J. Dürst <duerst@...>
Hello everybody,
4 messages
2021/04/22
[#103596] [Ruby master Feature#17830] Add Integer#previous and Integer#prev — rafasoaresms@...
Issue #17830 has been reported by rafasoares (Rafael Soares).
9 messages
2021/04/26
[ruby-core:103306] [Ruby master Bug#15735] Thread#handle_interrupt does not prevent Thread#kill from interrupting
From:
merch-redmine@...
Date:
2021-04-08 15:11:29 UTC
List:
ruby-core #103306
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<mask_stack_len; i++) {
mask = mask_stack[mask_stack_len-(i+1)];
@@ -2023,6 +2024,15 @@ rb_threadptr_pending_interrupt_check_mask(rb_thread_t *th, VALUE err)
}
/* try to next mask */
}
+
+ /* eKillSignal and eTerminateSignal are Integers, but should be
+ * rescued if using Exception in Thread.handle_interrupt.
+ */
+ if (err == rb_cInteger) {
+ err = rb_eException;
+ goto retry;
+ }
+
return INTERRUPT_NONE;
}
```
----------------------------------------
Bug #15735: Thread#handle_interrupt does not prevent Thread#kill from interrupting
https://bugs.ruby-lang.org/issues/15735#change-91391
* Author: inoueyu (Yuki INOUE)
* Status: Closed
* Priority: Normal
* ruby -v: 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
https://docs.ruby-lang.org/en/trunk/Thread.html#method-c-handle_interrupt
According to the documentation above, `Thread#handle_interrupt(Exception => :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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>