1
2
3
4
5 package main
6
7 import "C"
8
9 import (
10 "os"
11 "os/signal"
12 "syscall"
13 "time"
14 )
15
16
17 var sigioChan chan os.Signal
18
19
20
21 func CatchSIGIO() {
22 sigioChan = make(chan os.Signal, 1)
23 signal.Notify(sigioChan, syscall.SIGIO)
24 }
25
26
27
28 func ResetSIGIO() {
29 signal.Reset(syscall.SIGIO)
30 }
31
32
33
34 func SawSIGIO() C.int {
35 select {
36 case <-sigioChan:
37 return 1
38 case <-time.After(100 * time.Millisecond):
39 return 0
40 }
41 }
42
43 func main() {
44 }
45
View as plain text