Skip to content

Commit 3d6a4f8

Browse files
committed
[GR-17457] Ensure the thread is inside Queue#pop before thread.raise in handle_interrupt spec
PullRequest: truffleruby/2366
2 parents 95ff802 + afb043e commit 3d6a4f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/ruby/core/thread/handle_interrupt_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def make_handle_interrupt_thread(interrupt_config, blocking = true)
1515
begin
1616
in_handle_interrupt << true
1717
if blocking
18+
Thread.pass # Make it clearer the other thread needs to wait for this one to be in #pop
1819
can_continue.pop
1920
else
2021
begin
@@ -34,6 +35,10 @@ def make_handle_interrupt_thread(interrupt_config, blocking = true)
3435
end
3536

3637
in_handle_interrupt.pop
38+
if blocking
39+
# Ensure the thread is inside Thread#pop, as if thread.raise is done before it would be deferred
40+
Thread.pass until thread.stop?
41+
end
3742
thread.raise interrupt_class, "interrupt"
3843
can_continue << true
3944
thread.join

0 commit comments

Comments
 (0)