aboutsummaryrefslogtreecommitdiff
path: root/os_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'os_unix.go')
-rw-r--r--os_unix.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/os_unix.go b/os_unix.go
new file mode 100644
index 0000000..5afe392
--- /dev/null
+++ b/os_unix.go
@@ -0,0 +1,21 @@
+//go:build linux || openbsd || freebsd || netbsd || dragonfly || solaris || darwin || aix
+
+package main
+
+import (
+ "os"
+ "os/signal"
+ "runtime/pprof"
+ "syscall"
+)
+
+func backtrace_listen() {
+ go func() {
+ ch := make(chan os.Signal, 1)
+ signal.Notify(ch, syscall.SIGUSR1)
+ for {
+ <-ch
+ pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
+ }
+ }()
+}