Documentation ¶
Index ¶
- func LockedScope(l sync.Locker, action func())
- func WaitGroup(ctx context.Context) (*sync.WaitGroup, error)
- func WithFuture(parent context.Context) (context.Context, *future.Future)
- func WithWaitGroup(parent context.Context) (context.Context, *sync.WaitGroup)
- type JoinChan
- type Runner
- type Starter
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LockedScope ¶
func WithFuture ¶
WithFuture return a future for reading a returned value from the child routine.
Note that the set future is only available for the first child routine, meaning it will not propagate recursively to lover level child routines. However, the child routine can setup its own future.
Types ¶
type JoinChan ¶
type JoinChan chan struct{}
JoinChan is a signal channel in order to wait for a async Worker to finish.
func WithJoinChan ¶
WithJoinChan returns a join channel in order for the parent routine to wait for the child to finish.
Note that the set channel is only available for the first child routine, meaning it will not propagate recursively to lover level child routines. However, the child routine can setup its own join channel.
type Runner ¶
Runner is the task callback method. Will be invoked only once. Is is up to the user to add an infinite loop for a continues Worker. Must consume ctx.Done signal.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func MakeWorker ¶
MakeWorker creates a new Worker instance with the provided runnable object. Runner must be thread-safe.