workpool

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package workpool 定义协程池

Package workpool 定义协程池

Package workpool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobBag

type JobBag struct {
	JobFunc WorkFunc
	Params  []interface{}
}

type WorkFunc

type WorkFunc func(...interface{})

type WorkPool

type WorkPool interface {
	// SubmitJob 提交任务
	SubmitJob(job ...*JobBag)
	// GetPoolIdleSize get pool idle size
	GetPoolIdleSize() int
	// GetJobQueueIdleSize 获取job队列空闲成都
	GetJobQueueIdleSize() int
	// ShutDownPool 关闭工作池
	ShutDownPool()
	// IsShutDownPool 获取是否关闭
	IsShutDownPool() bool
	// IsFinished get pool execute info, true is finished false is running
	IsFinished() bool

	// WaitFinish 等待任务完成通知
	WaitFinish()
}

func NewWorkPool

func NewWorkPool(maxPoolSize int, poolName string, executeIntervalMS int64, jobQueueMaxSize int) WorkPool

NewWorkPool 初始化work pool maxPoolSize work pool size > 0 poolName pool name executeIntervalMS worker executeIntervalMS, 0 is not be used jobQueueMaxSize job queue max size

Jump to

Keyboard shortcuts

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