Sha256: e7c8e9de0b94af0ce2ff130e432f23a029b6b74cbd1e2680263c16dba3036e28
Contents?: true
Size: 1.82 KB
Versions: 22
Compression:
Stored size: 1.82 KB
Contents
# Many operating systems allow signals to be sent to running processes. # Some signals have a defined effect on the process, while others may be # trapped at the code level and acted upon. For example, your process may # trap the USR1 signal and use it to toggle debugging, and may use TERM to # initiate a controlled shutdown. # # ```ruby # pid = fork do # Signal.trap("USR1") do # $debug = !$debug # puts "Debug now: #$debug" # end # Signal.trap("TERM") do # puts "Terminating..." # shutdown() # end # # . . . do some work . . . # end # # Process.detach(pid) # # # Controlling program: # Process.kill("USR1", pid) # # ... # Process.kill("USR1", pid) # # ... # Process.kill("TERM", pid) # ``` # # produces: # # ``` # Debug now: true # Debug now: false # Terminating... # ``` # # The list of available signal names and their interpretation is system # dependent. [Signal](Signal) delivery semantics may # also vary between systems; in particular signal delivery may not always # be reliable. module Signal # Returns a list of signal names mapped to the corresponding underlying # signal numbers. # # ```ruby # Signal.list #=> {"EXIT"=>0, "HUP"=>1, "INT"=>2, "QUIT"=>3, "ILL"=>4, "TRAP"=>5, "IOT"=>6, "ABRT"=>6, "FPE"=>8, "KILL"=>9, "BUS"=>7, "SEGV"=>11, "SYS"=>31, "PIPE"=>13, "ALRM"=>14, "TERM"=>15, "URG"=>23, "STOP"=>19, "TSTP"=>20, "CONT"=>18, "CHLD"=>17, "CLD"=>17, "TTIN"=>21, "TTOU"=>22, "IO"=>29, "XCPU"=>24, "XFSZ"=>25, "VTALRM"=>26, "PROF"=>27, "WINCH"=>28, "USR1"=>10, "USR2"=>12, "PWR"=>30, "POLL"=>29} # ``` def self.list: () -> ::Hash[String, Integer] def self.signame: (Integer arg0) -> String? def self.trap: (Integer | String | Symbol signal, ?untyped command) -> (String | Proc) | (Integer | String | Symbol signal) { (Integer arg0) -> untyped } -> (String | Proc) end
Version data entries
22 entries across 22 versions & 2 rubygems
Version | Path |
---|---|
steep-0.13.0 | vendor/ruby-signature/stdlib/builtin/signal.rbs |
steep-0.12.0 | vendor/ruby-signature/stdlib/builtin/signal.rbs |