Issue #12405 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONE to 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: DONE, 2.4: DONE

ruby_2_3 r58036 merged revision(s) 57477,57478,57479.

----------------------------------------
Bug #12405: Queue doesn't work inside of trap
https://bugs.ruby-lang.org/issues/12405#change-63691

* Author: kirillrdy (Kirill Radzikhovskyy)
* Status: Closed
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: DONE, 2.4: DONE
----------------------------------------
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 )



-- 
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>