pool

package
v0.0.0-...-157c77b Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCapacity = 10
	DefaultTimeOut  = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoroutinePool

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

func NewGoroutinePool

func NewGoroutinePool(opts ...PoolOption) *GoroutinePool

func (*GoroutinePool) Close

func (p *GoroutinePool) Close()

func (*GoroutinePool) Submit

func (p *GoroutinePool) Submit(task f) error

Submit 提交执行的任务

type PoolOption

type PoolOption func(pool *GoroutinePool)

func WithCapacity

func WithCapacity(capacity int32) PoolOption

func WithTimeout

func WithTimeout(timeout time.Duration) PoolOption

type Worker

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

Worker 对协程进行封装的worker,每一个worker绑定一个goroutine

func (*Worker) Close

func (w *Worker) Close()

Jump to

Keyboard shortcuts

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