wpool

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 6 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 is a worker pool bind with some idle goroutines.

func New

func New(maxIdle int, maxIdleTime time.Duration) *Pool

New creates a new worker pool.

func (*Pool) Go

func (p *Pool) Go(task Task)

Go creates/reuses a worker to run task.

func (*Pool) GoCtx added in v0.4.3

func (p *Pool) GoCtx(ctx context.Context, task Task)

GoCtx creates/reuses a worker to run task.

func (*Pool) Size

func (p *Pool) Size() int32

Size returns the number of the running workers.

type Task

type Task func()

Task is the function that the worker will execute.

Jump to

Keyboard shortcuts

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