Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoAsync ¶
DoAsync calls the given function in a new goroutine.
If there is a limit on active goroutines within the group, it blocks until it can be spawned without surpassing the limit. If the passed context is canceled, a failed future is returned.
If the group was created with Option WithCancel, the first call that returns a non-nil error will cancel the group's context. This error will subsequently be returned by Group.Wait.
Types ¶
type ExecutionError ¶
type ExecutionError struct {
Value any
}
func (ExecutionError) Error ¶
func (e ExecutionError) Error() string
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
A Group represents a set of collaborating goroutines within a common overarching task.
Should this group have a limit of active goroutines or cancel on the first error it needs to be created with New.
func (*Group) Do ¶
Do calls the given function synchronously.
If the group was created with Option WithCancel, the first call that returns a non-nil error will cancel the group's context. This error will subsequently be returned by Group.Wait.
func (*Group) Go ¶
Go calls the given function in a new goroutine.
It is here for compatibility reasons and calls Group.GoCtx with context.TODO. You should consider calling that function instead.
func (*Group) GoCtx ¶
GoCtx calls the given function in a new goroutine.
If there is a limit on active goroutines within the group, it blocks until it can be spawned without surpassing the limit. If the passed context is canceled, an error is returned.
If the group was created with Option WithCancel, the first call that returns a non-nil error will cancel the group's context. This error will subsequently be returned by Group.Wait.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option defines configurations for New.
func WithCancel ¶
func WithCancel(cancel context.CancelCauseFunc) Option
WithCancel is an Option to cancel a context on the first error.
cancel is a function retrieved from context.WithCancelCause.