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.
14 static void CRaiseSIGPIPE() {
17 if (pipe(fds) == -1) {
21 // Close the reader end
23 // Write to the writer end to provoke a SIGPIPE
24 if (write(fds[1], "some data", 9) != -1) {
25 fprintf(stderr, "write to a closed pipe succeeded\n");
39 // RunGoroutines starts some goroutines that don't do anything.
40 // The idea is to get some threads going, so that a signal will be delivered
41 // to a thread started by Go.
43 //export RunGoroutines
44 func RunGoroutines() {
45 for i := 0; i < 4; i++ {
47 runtime.LockOSThread()
53 // Block blocks the current thread while running Go code.
62 // TestSEGV makes sure that an invalid address turns into a run-time Go panic.
68 fmt.Fprintln(os.Stderr, "no panic from segv")
73 fmt.Fprintln(os.Stderr, "continued after segv")
77 // Noop ensures that the Go runtime is initialized.
85 //export GoRaiseSIGPIPE
86 func GoRaiseSIGPIPE() {