Source file
misc/cgo/test/issue6997_linux.go
1
2
3
4
5
6
7
8
9
10
11 package cgotest
12
13
19 import "C"
20
21 import (
22 "testing"
23 "time"
24 )
25
26 func test6997(t *testing.T) {
27 r := C.StartThread()
28 if r != 0 {
29 t.Error("pthread_create failed")
30 }
31 c := make(chan C.int)
32 go func() {
33 time.Sleep(500 * time.Millisecond)
34 c <- C.CancelThread()
35 }()
36
37 select {
38 case r = <-c:
39 if r == 0 {
40 t.Error("pthread finished but wasn't canceled??")
41 }
42 case <-time.After(30 * time.Second):
43 t.Error("hung in pthread_cancel/pthread_join")
44 }
45 }
46
View as plain text