routine

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoEnableRoutinePool = errors.New("not enable routine pool, please add enableRtePool field to settings")
)

Functions

func AddTask

func AddTask(taskFunc TaskFunc) error

AddTask 添加任务

func CloseDefaultTask added in v1.2.2

func CloseDefaultTask() error

func CountInfo

func CountInfo() (map[string]int, error)

CountInfo 获取协程池个数信息

func SetUpDefaultTask

func SetUpDefaultTask(conf settings.Routine) func() error

SetUpDefaultTask 初始化后台任务

Types

type Task

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

func SetUp

func SetUp(conf settings.Routine) (*Task, error)

SetUp 初始化协程池

func (*Task) AsyncDO

func (task *Task) AsyncDO(taskFunc TaskFunc) error

AsyncDO 添加任务, 如果有设置

func (*Task) Close

func (task *Task) Close()

Close 关闭协程池

func (Task) CountInfo

func (task Task) CountInfo() map[string]int

CountInfo 获取协程池个数信息

func (*Task) Reboot

func (task *Task) Reboot()

Reboot 重启关闭的协程池

type TaskFunc

type TaskFunc func()

Jump to

Keyboard shortcuts

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