Skip to content
A small package for a golang worker pool
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
Readme.md
workerpool.go

Readme.md

WorkerPool

My modifications to a blog post from an employee at Malwarebytes

Goal

Package my modifications for easy reuse

Example

See example/example.go for the full code

// Initialize a Dispatcher
dispatcher := wp.NewDispatcher(2, 1024)
// Start the Dispatcher and create/register the Workers to the WorkerPool
dispatcher.Run()

// Queue two jobs for processing
dispatcher.WaitGroup.Add(2)
dispatcher.JobQueue <- SomeJob1{}
dispatcher.JobQueue <- SomeJob2{}

// Block main thread until processing in go routines completes
dispatcher.WaitGroup.Wait()
You can’t perform that action at this time.