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 ¶
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.
Click to show internal directories.
Click to hide internal directories.