pool

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init 初始化协程池

func SetDefaultJobQueueLen

func SetDefaultJobQueueLen(length int)

SetDefaultJobQueueLen 设置默认job queue长度

func SetDefaultWorkerCount

func SetDefaultWorkerCount(count int)

SetDefaultWorkerCount 设置默认worker数量

func SetWorkerPool

func SetWorkerPool(p *Pool)

SetWorkerPool 设置worker pool

Types

type Job

type Job func()

type Pool

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

func GetWorkerPool

func GetWorkerPool() *Pool

GetWorkerPool 获取worker pool

func NewPool

func NewPool(workerCount, jobQueueLen int) *Pool

func (*Pool) AddJob

func (p *Pool) AddJob(job Job)

func (*Pool) Start

func (p *Pool) Start()

func (*Pool) Stop

func (p *Pool) Stop()

func (*Pool) Wait

func (p *Pool) Wait()

type Worker

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

func NewWorker

func NewWorker(id int, jobQueue chan Job) *Worker

Jump to

Keyboard shortcuts

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