loopfunc

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Overview

Package loopfunc : 用于控制需要持续运行的循环方法,当方法漰溃时会自动重启

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoFunc added in v1.3.5

func GoFunc(f func(params ...interface{}), name string, logWriter io.Writer, params ...interface{})

GoFunc 执行安全的子线程工作,包含panic捕获

f: 要执行的循环方法,可控制传入参数

name:这个方法的名称,用于错误标识

logWriter:方法崩溃时的日志记录器,默认os.stdout

params: 需要传给f的参数,f内需要进行类型转换

func LoopFunc

func LoopFunc(f func(params ...interface{}), name string, logWriter io.Writer, params ...interface{})

LoopFunc 执行循环工作,并提供panic恢复

f: 要执行的循环方法,可控制传入参数

name:这个方法的名称,用于错误标识

logWriter:方法崩溃时的日志记录器,默认os.stdout

params: 需要传给f的参数,f内需要进行类型转换

func LoopWithWait added in v1.3.5

func LoopWithWait(f func(params ...interface{}), name string, logWriter io.Writer, timewait time.Duration, params ...interface{})

LoopWithWait 执行循环工作,并在指定的等待时间后提供panic恢复

f: 要执行的循环方法,可控制传入参数

name:这个方法的名称,用于错误标识

logWriter:方法崩溃时的日志记录器,默认os.stdout

params: 需要传给f的参数,f内需要进行类型转换

Types

type CrashLogger added in v1.3.5

type CrashLogger struct {
	FilePath string
	// contains filtered or unexported fields
}

CrashLogger 主进程崩溃用日志

func (*CrashLogger) Write added in v1.3.5

func (m *CrashLogger) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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