...
1
2
3
4
5 package main
6
7 import (
8 "fmt"
9 "os"
10 "runtime"
11 )
12
13 func init() {
14 register("CrashDumpsAllThreads", CrashDumpsAllThreads)
15 }
16
17 func CrashDumpsAllThreads() {
18 const count = 4
19 runtime.GOMAXPROCS(count + 1)
20
21 chans := make([]chan bool, count)
22 for i := range chans {
23 chans[i] = make(chan bool)
24 go crashDumpsAllThreadsLoop(i, chans[i])
25 }
26
27
28 for _, c := range chans {
29 <-c
30 }
31
32
33 if _, err := os.NewFile(3, "pipe").WriteString("x"); err != nil {
34 fmt.Fprintf(os.Stderr, "write to pipe failed: %v\n", err)
35 os.Exit(2)
36 }
37
38 select {}
39 }
40
41 func crashDumpsAllThreadsLoop(i int, c chan bool) {
42 close(c)
43 for {
44 for j := 0; j < 0x7fffffff; j++ {
45 }
46 }
47 }
48
View as plain text