workerpool

package
v0.0.0-...-e0ff526 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkerPool

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

WorkerPool is a struct used for managing a pool of worker goroutines.

func New

func New(size int) *WorkerPool

Return a WorkerPool instance with the given number of worker goroutines.

func (*WorkerPool) Go

func (p *WorkerPool) Go(fn func())

Go enqueues the given function onto the queue. Blocks until a worker is available to run the function. Panics if Wait() has already been called.

func (*WorkerPool) Wait

func (p *WorkerPool) Wait()

Wait closes the queue and waits until all workers are finished. The WorkerPool cannot be reused again.

Jump to

Keyboard shortcuts

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