xparallelizer

package
v0.0.0-...-f7d7e86 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

Group a group of workers executing functions concurrently

func NewGroup

func NewGroup(options ...GroupOption) *Group

NewGroup create a new group of workers

func (*Group) Add

func (g *Group) Add(function func()) error

Add adds function to queue of jobs to execute

func (*Group) Close

func (g *Group) Close()

Close closes resources

func (*Group) Wait

func (g *Group) Wait(options ...WaitOption) error

Wait waits until workers finished the jobs in the queue

type GroupOption

type GroupOption func(*GroupOptions)

GroupOption an option for Groups

func WithJobQueueSize

func WithJobQueueSize(size int) GroupOption

WithJobQueueSize sets job size

func WithPoolSize

func WithPoolSize(size int) GroupOption

WithPoolSize sets pool size

type GroupOptions

type GroupOptions struct {
	PoolSize     int
	JobQueueSize int
}

GroupOptions configuration for the Group

type WaitOption

type WaitOption func(*WaitOptions)

WaitOption an option for Waiting

func WithContext

func WithContext(ctx context.Context) WaitOption

WithContext sets context

type WaitOptions

type WaitOptions struct {
	Context context.Context
}

WaitOptions configuration for the Wait

Jump to

Keyboard shortcuts

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