lifecycle

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(attempts int, sleep int, fn func() (error, bool)) (err error)

Retry 重試

Types

type LifeCycle

type LifeCycle struct {
	// contains filtered or unexported fields
}

LifeCycle 应用程序生命周期

func New

func New() *LifeCycle

New .

func Std

func Std() *LifeCycle

Std ..

func (*LifeCycle) AddCloseFunc

func (l *LifeCycle) AddCloseFunc(f func() error)

AddCloseFunc 添加退出任务

func (*LifeCycle) AddCloser

func (l *LifeCycle) AddCloser(clr io.Closer)

AddCloser 添加退出任务

func (*LifeCycle) C

func (l *LifeCycle) C() <-chan struct{}

C .

func (*LifeCycle) Context added in v0.1.22

func (l *LifeCycle) Context() context.Context

Context 上下文

func (*LifeCycle) Exit

func (l *LifeCycle) Exit()

Exit 强制退出

func (*LifeCycle) SetSignals

func (l *LifeCycle) SetSignals(sigs ...os.Signal)

SetSignals 设置监听的信号量

func (*LifeCycle) SetTimeout

func (l *LifeCycle) SetTimeout(d time.Duration)

SetTimeout 退出超时时间

func (*LifeCycle) WaitExit

func (l *LifeCycle) WaitExit()

WaitExit .

Jump to

Keyboard shortcuts

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