routine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(ctx context.Context, fn func())

Go 启动写的协程

func GoWithParams

func GoWithParams(ctx context.Context, fn func(ctx context.Context, ps ...interface{}), params ...interface{})

Go 启动写的协程

func GoWithRecover

func GoWithRecover(ctx context.Context, fn func(c context.Context))

GoWithRecover 常驻协程,不死不灭。协程崩溃后,记录日志,并自动拉起 主要用于主进程不结束,该方法启动的协程不结束。 ctx 参数要带一些 value,标记启动的时机,业务。方便log输出

func GoWithSignal

func GoWithSignal(ctx context.Context, fn func()) chan interface{}

GoWithSignal 开启一个新的协程,并且返回一个channel,用于反馈执行结果 0 表示执行成功;其他失败;

func New

func New(name string, fn Callback, params []interface{})

New 创建一个异步任务

func NewSimple

func NewSimple(name string, f func())

NewSimple 简化创建一个异步任务

Types

type Callback

type Callback func(args ...interface{}) error

type TaskChanObj

type TaskChanObj interface {
	GetConext() context.Context
}

TaskChanObj

Jump to

Keyboard shortcuts

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