runtime

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PanicHandlers = []func(interface{}){logPanic}

Functions

func Call

func Call(callers ...errCaller) error

Call 同步依次执行函数,只要有一个返回err,直接返回 通过此方法可以减少if err != nil { return }的判断

func GetMem added in v1.1.4

func GetMem() uint64

func HandleCrash

func HandleCrash(additionalHandlers ...func(interface{}))

func HandleError added in v1.1.4

func HandleError(err error, fn func(err error))

func HandleNil added in v1.1.4

func HandleNil[T any](pointer *T, fn func(notNilPointer *T))

func IgnoreErrorCaller added in v1.1.4

func IgnoreErrorCaller(caller errCaller) func()

IgnoreErrorCaller return new function that will ignore error

func SetReallyCrash

func SetReallyCrash(really bool)

func ShowMemoryUsage added in v1.1.4

func ShowMemoryUsage()

func Shutdown

func Shutdown(callback func())

shutdown 关闭服务

func WaitClose

func WaitClose(stop <-chan struct{}, closeFunc ...func())

WaitClose is a helper function that waits for the channel to close and invoke the callback

Types

type ChanWatcher added in v1.1.4

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

ChanWatcher implements the Watcher interface with channel.

func NewWatcher added in v1.1.4

func NewWatcher(chs ...chan struct{}) *ChanWatcher

func (*ChanWatcher) Stop added in v1.1.4

func (w *ChanWatcher) Stop()

type Runnable added in v1.1.7

type Runnable interface {
	Run(done <-chan struct{})
}

type Watcher added in v1.1.4

type Watcher interface {
	Stop()
}

Watcher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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