Forum: Ruby-core [ruby-trunk - Feature #7923][Assigned] Queue#push and Queue#pop makes trap safe

Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-23 23:11
(Received via mailing list)
Issue #7923 has been reported by kosaki (Motohiro KOSAKI).

----------------------------------------
Feature #7923: Queue#push and Queue#pop makes trap safe
https://bugs.ruby-lang.org/issues/7923

Author: kosaki (Motohiro KOSAKI)
Status: Assigned
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: lib
Target version: next minor


Currently, following program don't work because q.push raises an 
exception.
However, it would be nice if queue is trap safe and Queue#push and 
Queue#pop can be called from trap handler.

------------------------------------------
require "thread"

q = Queue.new

trap("USR1") {
  q.push(nil)
}

Process.kill :USR1, $$
sleep
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.