Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrExceedLimit error = errors.New("exceed limit")
)
Functions ¶
Types ¶
type ConGroup ¶
type ConGroup interface {
NewGroup(ctx context.Context, opts ...GroupOption) Group
}
func NewConGroup ¶
type Group ¶
type Group interface { // cancel all execution unit Cancel() // Wait wait all execution unit to quit Wait() error // Go start an execution unit, would be blocked when exceed limitation Go(GoFunc) // TryGo if exceeds limitation, return ErrExceedLimit TryGo(GoFunc) error // Errors() []error // WrapError() error }
Group execute group
type GroupOption ¶
type GroupOption interface {
// contains filtered or unexported methods
}
func WithCancelIfError ¶
func WithCancelIfError(enable bool) GroupOption
WithCancelIfError cancel all executions when one return error
type WaitChannel ¶
type WaitChannel <-chan struct{}
func NewWaitChannel ¶
func NewWaitChannel() WaitChannel
type WaitCloser ¶
type WaitCloser interface { Close(error) bool IsClosed() bool Error() error Context() context.Context Done() WaitChannel // sleep until expired or closed Sleep(time.Duration) // wait group interface WgAdd(int) WgDone() WgWait() }
WaitCloser is convenient for concurrent programming used to control lifetime of concurrent executions.
func NewWaitCloser ¶
func NewWaitCloser(stopFun func(error)) WaitCloser
func NewWaitCloserFromContext ¶
func NewWaitCloserFromContext(pctx context.Context, stopFun func(error)) WaitCloser
func NewWaitCloserFromParent ¶
func NewWaitCloserFromParent(p WaitCloser, stopFun func(error)) WaitCloser
type WaitNotifier ¶
type WaitNotifier chan struct{}
func NewWaitNotifier ¶
func NewWaitNotifier() WaitNotifier
Click to show internal directories.
Click to hide internal directories.