...
1
2
3
4
5 package main
6
7
16 import "C"
17
18 import (
19 "os"
20 "os/signal"
21 "sync/atomic"
22 "syscall"
23 )
24
25 var sigioCount int32
26
27
28
29
30 func GoCatchSIGIO() {
31 c := make(chan os.Signal, 1)
32 signal.Notify(c, syscall.SIGIO)
33 go func() {
34 for range c {
35 atomic.AddInt32(&sigioCount, 1)
36 }
37 }()
38 }
39
40
41
42
43 func GoRaiseSIGIO(p *C.pthread_t) {
44 C.CRaiseSIGIO(p)
45 }
46
47
48
49
50 func SIGIOCount() C.int {
51 return C.int(atomic.LoadInt32(&sigioCount))
52 }
53
54 func main() {
55 }
56
View as plain text