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.
7 // Test that pthread_cancel works as expected
8 // (NPTL uses SIGRTMIN to implement thread cancelation)
9 // See https://golang.org/issue/6997
14 #cgo LDFLAGS: -pthread
15 extern int StartThread();
16 extern int CancelThread();
23 func test6997(t
*testing
.T
) {
26 t
.Error("pthread_create failed")
30 time
.Sleep(500 * time
.Millisecond
)
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")