Documentation
¶
Overview ¶
Package pool provides the shared worker pool a flow owns and hands to any block that needs parallelism (e.g. a fork running its branches concurrently). Simple flows stay single-threaded while concurrent composites schedule work without each owning their own goroutines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool runs tasks on a fixed set of worker goroutines reading a bounded queue.
func New ¶
New builds a pool with a bounded task queue. workers and queue are clamped to their defaults when non-positive.
func (*Pool) Start ¶
func (p *Pool) Start()
Start spawns the worker goroutines. They are ready before any task is submitted.
func (*Pool) Stop ¶
func (p *Pool) Stop()
Stop closes the task queue and waits for in-flight tasks to finish. It must be called only after every submitter has stopped (i.e. after the outer workers drain).
func (*Pool) Submit ¶
func (p *Pool) Submit(task func())
Submit enqueues a task without blocking. A full queue means the pool is exhausted; rather than risk a silent deadlock (a caller waiting on a task that can never be scheduled), Submit panics. This is a deliberate, documented limitation of the current model: size the pool for the flow's fan-out.