workpool

package
v0.0.0-...-c6a18d5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 6 Imported by: 0

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