work

package
v0.0.0-...-3f48b55 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 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 Pool

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

Pool 提供一个goroutine池,这个池可以完成任何已提交的Worker任务

func New

func New(maxGoroutines int) *Pool

New 创建一个新工作地

func (*Pool) Run

func (p *Pool) Run(w Worker)

Run 提交工作到工作地

func (*Pool) Shutdown

func (p *Pool) Shutdown()

Shutdown 等待所有goroutine停止工作

type Worker

type Worker interface {
	Task()
}

Worker 必须满足接口类型

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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