Class: Oxidized::Signals
- Inherits:
-
Object
- Object
- Oxidized::Signals
- Defined in:
- lib/oxidized/signals.rb
Class Attribute Summary collapse
-
.handlers ⇒ Object
Returns the value of attribute handlers.
Class Method Summary collapse
Class Attribute Details
.handlers ⇒ Object
Returns the value of attribute handlers.
19 20 21 |
# File 'lib/oxidized/signals.rb', line 19 def handlers @handlers end |
Class Method Details
.handle_signal(signum) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/oxidized/signals.rb', line 35 def handle_signal(signum) return unless handlers.has_key?(signum) @handlers[signum].each do |handler| handler.call end end |
.register_signal(sig, procobj) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/oxidized/signals.rb', line 21 def register_signal(sig, procobj) # Compute short name of the signal (without SIG prefix) sigshortname = sig.gsub "SIG", '' signum = Signal.list[sigshortname] # Register the handler with OS Signal.trap signum do Oxidized::Signals.handle_signal(signum) end # Add the proc to the handler list for the requested signal @handlers[signum].push(procobj) end |