From: Tanaka Akira Date: 2013-08-27T20:45:16+09:00 Subject: [ruby-core:56825] Re: [ruby-trunk - Feature #8823][Open] Run trap handler in an independent thread called "Signal thread" 2013/8/27 ko1 (Koichi Sasada) : > Feature #8823: Run trap handler in an independent thread called "Signal thread" > https://bugs.ruby-lang.org/issues/8823 > How about to make an "Signal thread" to run trap handler? I think it is a right direction. However, I know trap is used to interrupt a thread. For example, irb raises an exception in a trap handler. lib/irb.rb: trap("SIGINT") do irb.signal_handle end ... def signal_handle ... case @signal_status when :IN_INPUT ... raise RubyLex::TerminateLineInput when :IN_EVAL IRB.irb_abort(self) ... end end I suspect "raise RubyLex::TerminateLineInput" doesn't work as expected after your proposal is implemented because the current thread will be the signal thread. It is described as the disadvantage: > == Disadvantage: > * There is a small compatibility issue because �Thread.current� on a trap handler is not a main thread. Maybe, you should update irb (and possibly other libraries) as well as your signal thread implementation. -- Tanaka Akira