1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Package signal implements operating system-independent signal handling.
13 // A Signal can represent any operating system signal.
14 type Signal
interface {
20 func (sig UnixSignal
) String() string {
21 s
:= runtime
.Signame(int32(sig
))
25 return "Signal " + strconv
.Itoa(int(sig
))
28 // Incoming is the global signal channel.
29 // All signals received by the program will be delivered to this channel.
30 var Incoming
<-chan Signal
32 func process(ch
chan<- Signal
) {
34 var mask
uint32 = runtime
.Sigrecv()
35 for sig
:= uint(0); sig
< 32; sig
++ {
36 if mask
&(1<<sig
) != 0 {
45 ch
:= make(chan Signal
) // Done here so Incoming can have type <-chan Signal