Project

General

Profile

Actions

Bug #12405

closed

Queue doesn't work inside of trap

Bug #12405: Queue doesn't work inside of trap

Added by kirillrdy (Kirill Radzikhovskyy) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
[ruby-core:75636]

Description

when adding things to the queue inside that trap blocking pop never unblocks

q = Queue.new Signal.trap 'INT' do puts "got INT" q << 'something' end Thread.new { loop { sleep 1 Process.kill :INT, $$ } } q.pop 

I know that there are limitations of what can be done inside of trap.
Looking at this https://bugs.ruby-lang.org/issues/6128 it looks like I should be able to use Queue inside a trap, but code above runs forever.
Also in jruby it behaives as expected ( at least in my understanding )

Actions

Also available in: PDF Atom