thread

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTaskBuffer = 100
View Source
const MainThreadID = math.MaxInt // 主线程ID

Variables

This section is empty.

Functions

func Go

func Go(task func())

Go 从默认线程池获取一个goroutine并派发任务

@param task

func GoByID

func GoByID[T int | int32 | int64](goID T, task func())

GoByID 根据指定的goroutineID派发线程

@receiver h
@param goID 若>0,派发到指定线程,否则随机派发
@param task

func GoMain

func GoMain(task func())

GoMain 派发到主线程

@param task

func InitPool

func InitPool(p *ants.PoolWithID) error

InitPool 用默认参数初始化全局线程池

func PoolInstance added in v1.1.3

func PoolInstance() *ants.PoolWithID

func ReleaseTableGoPool

func ReleaseTableGoPool()

func WaitByID

func WaitByID[T int | int32 | int64](goID T, task func())

func WaitMain

func WaitMain(task func())

WaitMain 派发到主线程并等待执行完成

@param task

Types

This section is empty.

Jump to

Keyboard shortcuts

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