mirror of
https://github.com/pyihe/go-pkg.git
synced 2025-11-03 02:03:21 +08:00
remove signal
This commit is contained in:
@@ -35,11 +35,11 @@ func Wait(callbacks ...func()) {
|
|||||||
//SIGINT 用户发送INTR字符(Ctrl+C)触发
|
//SIGINT 用户发送INTR字符(Ctrl+C)触发
|
||||||
//SIGSTOP 停止进程(不能被捕获、阻塞或忽略)
|
//SIGSTOP 停止进程(不能被捕获、阻塞或忽略)
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT)
|
signal.Notify(ch, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||||
for {
|
for {
|
||||||
s := <-ch
|
s := <-ch
|
||||||
switch s {
|
switch s {
|
||||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT, syscall.SIGHUP:
|
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT, syscall.SIGHUP:
|
||||||
if len(callbacks) == 0 {
|
if len(callbacks) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user