workerjuice

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package workerjuice provides a simple semaphore implementation.

Package workerjuice provides a pool of workers for concurrent task execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool added in v1.6.8

type Pool interface {
	AddWorker()
	RemoveWorker()
	WorkerCount() int
	Wait()
	Close()
}

Create an interface for the Pool struct.

func CreateEmptyPool

func CreateEmptyPool(maxWorkers uint) Pool

CreateEmptyPool creates a new worker pool with the specified maximum number of workers.

It returns a pointer to the created Pool.

type SemaphoreInterface added in v1.5.4

type SemaphoreInterface interface {
	// Acquire acquires a resource controlled by the semaphore.
	Acquire()
	// Release releases a resource controlled by the semaphore.
	Release()
	// Wait blocks until all resources have been released.
	Wait()
}

SemaphoreInterface defines the methods that a semaphore should implement.

func NewSemaphore added in v1.5.4

func NewSemaphore(concurrency int) SemaphoreInterface

NewSemaphore creates a new Semaphore with the specified concurrency level.

type Worker added in v1.6.8

type Worker struct{}

Worker represents a worker in a worker pool.

Jump to

Keyboard shortcuts

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