parallel

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job added in v1.0.5

type Job func(string) error

type SPool

type SPool struct {
	TotalNum    int
	CounterOk   int
	CounterFail int
	CounterOut  int

	TimeStart int64
	TimeOut   int
	Debug     bool
	// contains filtered or unexported fields
}

/共享协程池

func NewSPool

func NewSPool(workerNum int, totalNum int, timeout int, debug bool) *SPool

协程池 timeout=0 关闭超时统计 debug=true 打开模式

func (*SPool) Commit

func (p *SPool) Commit(w WorkerInterface)

提交任务

func (*SPool) CountFail

func (p *SPool) CountFail()

计数器-失败

func (*SPool) CountOk

func (p *SPool) CountOk()

计数器-执行成功

func (*SPool) CountOut

func (p *SPool) CountOut()

计数器-超时

func (*SPool) Release

func (p *SPool) Release()

等待组 关闭channel

func (*SPool) Runtimelog

func (p *SPool) Runtimelog()

log

type SPoolFunc added in v1.0.5

type SPoolFunc struct {
	TotalNum    int
	CounterOk   int
	CounterFail int
	CounterOut  int

	TimeStart int64
	TimeOut   int
	Debug     bool
	// contains filtered or unexported fields
}

/共享协程池

func NewSPoolFunc added in v1.0.5

func NewSPoolFunc(workerNum int, totalNum int, debug bool, job Job) *SPoolFunc

协程池 timeout=0 关闭超时统计 debug=true 打开模式

func (*SPoolFunc) Commit added in v1.0.5

func (p *SPoolFunc) Commit(id string)

提交任务

func (*SPoolFunc) Release added in v1.0.5

func (p *SPoolFunc) Release()

等待组 关闭channel

type WorkerInterface

type WorkerInterface interface {
	Task() error
	GetTaskID() interface{}
}

Jump to

Keyboard shortcuts

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