wpool

package
v0.11.3-generic-streaming Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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