OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [exp/] [signal/] [signal.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// 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.
4
 
5
// +build darwin freebsd linux netbsd openbsd
6
 
7
// Package signal implements operating system-independent signal handling.
8
package signal
9
 
10
import (
11
        "os"
12
        "runtime"
13
)
14
 
15
// Incoming is the global signal channel.
16
// All signals received by the program will be delivered to this channel.
17
var Incoming <-chan os.Signal
18
 
19
func process(ch chan<- os.Signal) {
20
        for {
21
                var mask uint32 = runtime.Sigrecv()
22
                for sig := uint(0); sig < 32; sig++ {
23
                        if mask&(1<
24
                                ch <- os.UnixSignal(sig)
25
                        }
26
                }
27
        }
28
}
29
 
30
func init() {
31
        runtime.Siginit()
32
        ch := make(chan os.Signal) // Done here so Incoming can have type <-chan Signal
33
        Incoming = ch
34
        go process(ch)
35
}
36
 
37
// BUG(rsc): This package is unavailable on Plan 9 and Windows.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.