introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it
[official-gcc.git] / libgo / misc / cgo / test / sigprocmask.go
blob39b658e96c3c0c4c9ba3afb5b794951333b523ec
1 // Copyright 2015 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 // +build !windows
7 package cgotest
9 /*
10 #cgo CFLAGS: -pthread
11 #cgo LDFLAGS: -pthread
12 extern int RunSigThread();
13 extern int CheckBlocked();
15 import "C"
16 import (
17 "os"
18 "os/signal"
19 "syscall"
20 "testing"
23 var blocked bool
25 //export IntoGoAndBack
26 func IntoGoAndBack() {
27 // Verify that SIGIO stays blocked on the C thread
28 // even when unblocked for signal.Notify().
29 signal.Notify(make(chan os.Signal), syscall.SIGIO)
30 blocked = C.CheckBlocked() != 0
33 func testSigprocmask(t *testing.T) {
34 if r := C.RunSigThread(); r != 0 {
35 t.Error("pthread_create/pthread_join failed")
37 if !blocked {
38 t.Error("Go runtime unblocked SIGIO")