signalKit

package
v3.0.94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ExitSignals 会将程序退出的所有能捕捉的信号
	/*
		参考: go-zero 中的"core/proc/signals.go".
	*/
	ExitSignals = []os.Signal{syscall.SIGTERM, syscall.SIGINT}
)

Functions

func MonitorExitSignalsSynchronously added in v3.0.67

func MonitorExitSignalsSynchronously(callbacks ...func(sig os.Signal))

MonitorExitSignalsSynchronously 同步地监听.

@param callbacks 可以不传

PS: (1) 会 阻塞 调用此函数的goroutine; (2) 理论上,应该 由main goroutine调用此函数 && 此函数只能被调用1次; (3) 按实际需求,可能要和 logrus.RegisterExitHandler() 搭配使用; (4) 执行顺序: 先执行 callbacks,再执行 logrus.RegisterExitHandler() 注册的handlers(有的话).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL