workpool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 2 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 TaskHandler

type TaskHandler func() error

TaskHandler Define function callbacks

type WorkPool

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

WorkPool serves incoming connections via a pool of workers

func New

func New(max int) *WorkPool

New new workpool and set the max number of concurrencies

func (*WorkPool) Do

func (p *WorkPool) Do(fn TaskHandler)

Do Add to the workpool and return immediately

func (*WorkPool) DoWait

func (p *WorkPool) DoWait(task TaskHandler)

DoWait Add to the workpool and wait for execution to complete before returning

func (*WorkPool) IsClosed

func (p *WorkPool) IsClosed() bool

IsClosed Has it been closed?

func (*WorkPool) IsDone

func (p *WorkPool) IsDone() bool

IsDone Determine whether it is complete (non-blocking)

func (*WorkPool) SetTimeout

func (p *WorkPool) SetTimeout(timeout time.Duration)

SetTimeout Setting timeout time

func (*WorkPool) Wait

func (p *WorkPool) Wait() error

Wait Waiting for the worker thread to finish executing

Jump to

Keyboard shortcuts

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