From fd0222caedf1be56faa004656bbf145522abbe68 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Thu, 9 Apr 2020 04:45:49 +0900 Subject: should check pending interrupts correctly. rb_uninterruptible() disables any interrupts using handle_interrupt feature (This function is used by `p`). After this function, pending interrupts should be checked correctly, however there is no chance to setup interrupt flag of working threads, it means that nobody checks pending interrupts. For example, it ignores terminate signal delivered at the end of main thread and program can't stop. This patch set interrupt flag if there are pending interrupts. --- bootstraptest/test_thread.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bootstraptest/test_thread.rb') diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index e7ddadf4a7..38a55ff229 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -484,3 +484,17 @@ assert_equal 'foo', %q{ GC.start f.call.source } +assert_normal_exit %q{ + class C + def inspect + sleep 0.5 + 'C!!' + end + end + Thread.new{ + loop{ + p C.new + } + } + sleep 0.1 +}, timeout: 5 -- cgit v1.2.3