Documentation ¶
Overview ¶
Additional synchronization primitives
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithPreLock ¶
func WithPreLock(opts *options)
WithPreLock option will prevent spawning goroutines if group capacity is exceeded.
Types ¶
type ErrSizedGroup ¶
type ErrSizedGroup struct {
// contains filtered or unexported fields
}
ErrSizedGroup has the same role as WaitingGroup but adds a limit of the amount of goroutines started concurrently. Uses similar Go() scheduling as errgroup.Group, thread safe.
func NewErrSizedGroup ¶
func NewErrSizedGroup(ctx context.Context, size int64, opts ...GroupOption) *ErrSizedGroup
NewErrSizedGroup makes wait group with limited size of alive goroutines.
func (*ErrSizedGroup) Go ¶
func (g *ErrSizedGroup) Go(fn func(ctx context.Context) error)
Go calls the given function in a new goroutine. Every call will be unblocked, but some goroutines may wait.
func (*ErrSizedGroup) Wait ¶
func (g *ErrSizedGroup) Wait() error
Wait blocks until all function calls from the Go method have returned.
type SizedGroup ¶
type SizedGroup struct {
// contains filtered or unexported fields
}
SizedGroup has the same role as WaitingGroup but adds a limit of the amount of goroutines started concurrently. Uses similar Go() scheduling as errgroup.Group, thread safe.
func NewSizedGroup ¶
func NewSizedGroup(ctx context.Context, size int64, opts ...GroupOption) *SizedGroup
NewSizedGroup makes wait group with limited size of alive goroutines.
func (*SizedGroup) Go ¶
func (g *SizedGroup) Go(fn func(ctx context.Context))
Go calls the given function in a new goroutine. Every call will be unblocked, but some goroutines may wait.
func (*SizedGroup) Wait ¶
func (g *SizedGroup) Wait()
Wait blocks until all function calls from the Go method have returned.