aboutsummaryrefslogtreecommitdiff
path: root/hydra.go
diff options
context:
space:
mode:
Diffstat (limited to 'hydra.go')
-rw-r--r--hydra.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/hydra.go b/hydra.go
index 5b29a75..2d5d9e3 100644
--- a/hydra.go
+++ b/hydra.go
@@ -5,6 +5,7 @@ import (
"github.com/yuin/gopher-lua"
"os"
"os/signal"
+ "runtime/pprof"
"syscall"
"time"
)
@@ -72,6 +73,15 @@ func main() {
signalChannel = make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
+ go func() {
+ ch := make(chan os.Signal, 1)
+ signal.Notify(ch, syscall.SIGUSR1)
+ for {
+ <-ch
+ pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
+ }
+ }()
+
l := lua.NewState()
defer l.Close()