This commit is contained in:
程广 2024-09-19 16:41:07 +08:00
parent 3173e66166
commit 533c3d1be0
2 changed files with 11 additions and 1 deletions

BIN
goemitter_test/main Executable file

Binary file not shown.

View File

@ -2,6 +2,9 @@ package main
import ( import (
"fmt" "fmt"
"log"
"runtime/debug"
"time"
emitter "git.pyer.club/kingecg/goemitter" emitter "git.pyer.club/kingecg/goemitter"
) )
@ -30,5 +33,12 @@ func main() {
}) })
em.EmitSync("test", "hello", "world") em.EmitSync("test", "hello", "world")
em.Emit("test", "hello", "world2") em.Emit("test", "hello", "world2")
select {} defer func() {
if r := recover(); r != nil {
log.Println("Recovered in main:", r)
// 打印当前所有 goroutine 的堆栈信息
log.Println(string(debug.Stack()))
}
}()
time.Sleep(1 * time.Second)
} }