gpool

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job func(id int)

Job 任务

type Pool

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

func NewPoolWithSize

func NewPoolWithSize(size int) *Pool

NewPoolWithSize 构造线程池

func (*Pool) AddJob

func (p *Pool) AddJob(job Job)

AddJob 追加任务

func (*Pool) ExitWait

func (p *Pool) ExitWait()

ExitWait 等待所有任务结束,退出前执行一次

func (*Pool) Start

func (p *Pool) Start()

func (*Pool) Stop

func (p *Pool) Stop()

type Worker

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

Worker work

func NewWorker

func NewWorker(id int) *Worker

NewWorker new worker

func (*Worker) Start

func (w *Worker) Start(jobCh <-chan Job)

Start 启动一个 Worker

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

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