* tree-vect-loop-manip.c (vect_do_peeling): Do not use
[official-gcc.git] / libgo / misc / cgo / test / issue6997_linux.go
blob0c98ea0794eec302d134e0855769758c7286ec35
1 // Copyright 2014 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 !android
7 // Test that pthread_cancel works as expected
8 // (NPTL uses SIGRTMIN to implement thread cancelation)
9 // See https://golang.org/issue/6997
10 package cgotest
13 #cgo CFLAGS: -pthread
14 #cgo LDFLAGS: -pthread
15 extern int StartThread();
16 extern int CancelThread();
18 import "C"
20 import "testing"
21 import "time"
23 func test6997(t *testing.T) {
24 r := C.StartThread()
25 if r != 0 {
26 t.Error("pthread_create failed")
28 c := make(chan C.int)
29 go func() {
30 time.Sleep(500 * time.Millisecond)
31 c <- C.CancelThread()
32 }()
34 select {
35 case r = <-c:
36 if r == 0 {
37 t.Error("pthread finished but wasn't canceled??")
39 case <-time.After(30 * time.Second):
40 t.Error("hung in pthread_cancel/pthread_join")