Documentation ¶
Overview ¶
Package pool contains a simple threadpool implementation that accepts work in the form of `func() error` function. The intent is for it to support similar workloads to errgroup, but with a maximum number of concurrent worker threads.
Index ¶
Constants ¶
View Source
const DefaultCapacity = 50
DefaultCapacity is the number of work items or errors that we can queue up before calls to Go will block, or work will block until Wait is called.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // Go queues a single unit of work for execution on this pool. All calls // to Go must be finished before Wait is called. Go(func() error) // Wait blocks until all work is complete, returning the first // error returned by any of the work. Wait() error }
Interface defines an errgroup-compatible interface for interacting with our threadpool.
func NewWithCapacity ¶
NewWithCapacity creates a fresh worker pool with the specified size.
Click to show internal directories.
Click to hide internal directories.