threading

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

threading package provides support for simple concurrency and threading

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ThreadPool

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

func NewThreadPool

func NewThreadPool(numberThreads int, loggingFrequency int) (*ThreadPool, error)

func NewThreadPoolWithJobQueue

func NewThreadPoolWithJobQueue(numberThreads, jobQueueSize int, loggingFrequency int) (*ThreadPool, error)

func (*ThreadPool) AddJob

func (t *ThreadPool) AddJob(job func() error)

AddJob adds a job to the thread pool. It increases the wait group counter and sends the job to the jobs channel.

func (*ThreadPool) PendingJobs

func (t *ThreadPool) PendingJobs() int

PendingJobs returns the number of jobs that are pending.

func (*ThreadPool) ProcessAndWait

func (t *ThreadPool) ProcessAndWait() error

ProcessAndWait blocks until all jobs have finished. If no jobs were added, it returns an error.

Jump to

Keyboard shortcuts

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