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.
42 //export RunGoroutines
43 func RunGoroutines() {
44 for i := 0; i < 4; i++ {
46 runtime.LockOSThread()
52 // Block blocks the current thread while running Go code.
60 // TestSEGV makes sure that an invalid address turns into a run-time Go panic.
65 fmt.Fprintln(os.Stderr, "no panic from segv")
70 fmt.Fprintln(os.Stderr, "continued after segv")
74 // Noop ensures that the Go runtime is initialized.
80 //export GoRaiseSIGPIPE
81 func GoRaiseSIGPIPE() {