wpool

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 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 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) 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