1 # depends on: module.rb
9 def self.trap(sig, prc=nil, pass_ctx=false, &block)
10 if sig.kind_of?(String)
17 unless number = Names[sig]
18 raise ArgumentError, "Unknown signal '#{osig}'"
25 raise ArgumentError, "Either a Proc or a block, not both."
30 old = @handlers[number]
32 @handlers[number] = prc
34 # If there is already at thread for this sig, give up.
35 return old if @threads[number]
50 @handlers[number].call(obj)
53 STDERR.pus "Exception while running signal handler: #{e.message}"
59 @threads[number] = thr
61 Scheduler.send_on_signal chan, number
65 def self.action(sig, prc=nil, &block)
66 trap(sig, prc, true, &block)
74 Rubinius::RUBY_CONFIG.keys.each do |key|
75 if key[0, 20] == 'rbx.platform.signal.'
76 Names[ key[23, 100] ] = Rubinius::RUBY_CONFIG[key]
79 # special case of signal.c
81 Names["CLD"] = Names["CHLD"]