Documentation
¶
Overview ¶
Package work manages a pool of routines to perform work. It does so my providing a Do function that will block when the pool is busy. This also allows the pool to monitor and report pushback.
Interface ¶
The Worker interface is how you can provide work to the pool.
// Worker must be implemented by types that want to use this worker processes.
type Worker interface {
Work(id int)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorInvalidMinRoutines = errors.New("Invalid minimum number of routines")
ErrorInvalidMinRoutines is the error for the invalid minRoutine parameter.
View Source
var ErrorInvalidStatTime = errors.New("Invalid duration for stat time")
ErrorInvalidStatTime is the error for the invalid stat time parameter.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool provides a pool of routines that can execute any Worker tasks that are submitted.
type State ¶
type State struct {
MinRoutines int // Minumum number of routines always in the pool.
StatTime time.Duration // Time to display stats.
Counter int // Maintains a running total number of routines ever created.
Routines int64 // Number of routines
Active int64 // Active number of routines in the work pool.
Pending int64 // Pending number of routines waiting to submit work.
}
State provides a pool state that are submitted.
Click to show internal directories.
Click to hide internal directories.