Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForAsync ¶ added in v0.1.3
func WaitForAsync(sigs ...*TerminateSignal)
WaitForAsync 函数等待所有的异步关闭信号 The WaitForAsync function waits for all asynchronous shutdown signals
func WaitForForceSync ¶ added in v0.1.3
func WaitForForceSync(sigs ...*TerminateSignal)
WaitForForceSync 函数等待所有的强制同步关闭信号 The WaitForForceSync function waits for all forced synchronous shutdown signals
func WaitForSync ¶ added in v0.1.3
func WaitForSync(sigs ...*TerminateSignal)
WaitForSync 函数等待所有的同步关闭信号 The WaitForSync function waits for all synchronous shutdown signals
func WaitingForGracefulShutdown
deprecated
func WaitingForGracefulShutdown(sigs ...*TerminateSignal)
WaitingForGracefulShutdown 函数等待所有的关闭信号 The WaitingForGracefulShutdown function waits for all shutdown signals
Deprecated: As of GS v0.1.3 this function simply calls WaitForAsync.
Types ¶
type TerminateSignal ¶
type TerminateSignal struct {
// contains filtered or unexported fields
}
TerminateSignal 结构体包含了一个 context,一个取消函数,一个等待组,一个函数切片和一个 sync.Once 实例 The TerminateSignal struct contains a context, a cancel function, a wait group, a function slice, and a sync.Once instance
func NewTerminateSignal ¶
func NewTerminateSignal() *TerminateSignal
NewTerminateSignal 创建一个带有超时的 TerminateSignal 实例 NewTerminateSignal creates a TerminateSignal instance with a timeout
func NewTerminateSignalWithContext ¶
func NewTerminateSignalWithContext(ctx context.Context) *TerminateSignal
NewTerminateSignalWithContext 创建一个带有上下文和超时的 TerminateSignal 实例 NewTerminateSignalWithContext creates a TerminateSignal instance with context and timeout
func (*TerminateSignal) Close ¶
func (s *TerminateSignal) Close(wg *sync.WaitGroup)
Close 方法异步关闭 TerminateSignal 实例 The Close method asynchronously closes the TerminateSignal instance
func (*TerminateSignal) GetStopContext ¶ added in v0.1.1
func (s *TerminateSignal) GetStopContext() context.Context
GetStopContext 获取停止信号的 Context GetStopContext gets the Context of the stop signal
func (*TerminateSignal) RegisterCancelCallback ¶ added in v0.1.1
func (s *TerminateSignal) RegisterCancelCallback(callbacks ...func())
RegisterCancelCallback 注册需要取消的回调函数 RegisterCancelCallback registers the callback functions to be canceled
func (*TerminateSignal) SyncClose ¶ added in v0.1.3
func (s *TerminateSignal) SyncClose(wg *sync.WaitGroup)
SyncClose 方法同步关闭 TerminateSignal 实例 The SyncClose method synchronously closes the TerminateSignal instance