task

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTask

func AddTask(task func())

AddTask 添加任务

func NewPool

func NewPool(opts ...Option) *defaultPool

func Release

func Release()

Release 释放任务

func SetPool

func SetPool(pool Pool)

SetPool 设置任务池

Types

type Option

type Option func(o *options)

func WithDisablePurge

func WithDisablePurge(disablePurge bool) Option

WithDisablePurge 设置是否禁用清除

func WithNonblocking

func WithNonblocking(nonblocking bool) Option

WithNonblocking 设置是否非阻塞

func WithSize

func WithSize(size int) Option

WithSize 设置任务池大小

type Pool

type Pool interface {
	// AddTask 添加任务
	AddTask(task func()) error
	// Release 释放任务
	Release()
}

func GetPool

func GetPool() Pool

GetPool 获取任务池

Jump to

Keyboard shortcuts

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