Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidTimeout = errors.New("timeout is zero or negative") ErrContextWithoutDeadline = errors.New("context has no deadline") )
Functions ¶
func CallWithContext ¶ added in v0.13.0
func CallWithTimeout ¶ added in v0.13.0
Types ¶
type CtxGroup ¶ added in v0.10.0
type CtxGroup struct {
// contains filtered or unexported fields
}
A CtxGroup is a collection of goroutines working on subtasks that are part of the same overall task.
func NewCtxGroup ¶ added in v0.10.0
NewCtxGroup returns a new CtxGroup with an derived Context from ctx.
type ErrGroup ¶ added in v0.7.0
type ErrGroup struct {
// contains filtered or unexported fields
}
A ErrGroup is a collection of goroutines working on subtasks that are part of the same overall task.
A zero ErrGroup is valid and does not cancel on error.
func NewErrGroup ¶ added in v0.7.0
NewErrGroup returns a new Group with an derived Context from ctx.
The derived Context is canceled the first time a function passed to Go returns a non-nil error or the first time Wait returns, whichever occurs first.
type WorkPool ¶ added in v0.14.0
type WorkPool struct {
// contains filtered or unexported fields
}
A WorkPool manages a pool of goroutines with a maximum concurrency limit. It uses semaphore to control the number of concurrent operations.
func NewWorkPool ¶ added in v0.14.0
NewWorkPool creates a new WorkPool with the specified maximum concurrency. maxWorkers defines the maximum number of concurrent goroutines that can run.
func (*WorkPool) Go ¶ added in v0.14.0
Go submits a function to be executed in the work pool. It will block if the maximum number of workers is already running. The function will be executed when a worker becomes available.
func (*WorkPool) MaxWorkers ¶ added in v0.14.0
MaxWorkers returns the maximum number of concurrent workers.