workers

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkItem

type WorkItem func()

WorkItem is an interface to work item used b the Workers

type Worker added in v0.16.0

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

Worker is a pool of workers.

func New

func New(ctx context.Context, workers int, logger *mylog.MyLog) *Worker

New creates a new worker pool with NumCPU runing workers

func (*Worker) Stop added in v0.16.0

func (w *Worker) Stop(ctx context.Context)

Stop stops all runing workers and wait them to finish and then leave the workerpool.

func (*Worker) Submit added in v0.16.0

func (w *Worker) Submit(ctx context.Context, wi func(wid, jid int))

Submit a work item to the worker pool

Jump to

Keyboard shortcuts

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