Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExitedNotifier ¶
type ExitedNotifier struct {
Channel chan bool
// contains filtered or unexported fields
}
ExitedNotifier When you call Finish(), all waiting goroutines will be resumed.
func NewExitedNotifier ¶
func NewExitedNotifier() *ExitedNotifier
NewExitedNotifier creates a new ExitedNotifier
func (*ExitedNotifier) Finish ¶
func (en *ExitedNotifier) Finish()
Finish resumes all waiting goroutines
func (*ExitedNotifier) TriggerOrCancel ¶
func (en *ExitedNotifier) TriggerOrCancel(f func()) func()
TriggerOrCancel sets f() to be called when Finish() is called. The returned function is a canceller. Note that you must call this when you no longer need f() to be called.
func (*ExitedNotifier) WaitWithContext ¶
func (en *ExitedNotifier) WaitWithContext(ctx context.Context)
WaitWithContext waits until Finish() is called or ctx is triggered.
type SimpleTrigger ¶
type SimpleTrigger chan bool
SimpleTrigger wakes up one waiting goroutine many times. The number that Wait() or <-trigger is called is NOT insured. Note that Wait() or <-trigger can be used by only one goroutine.
func NewSimpleTrigger ¶
func NewSimpleTrigger() SimpleTrigger
NewSimpleTrigger creates a new Trigger
func (SimpleTrigger) WaitWithContext ¶
func (trigger SimpleTrigger) WaitWithContext(ctx context.Context) error
WaitWithContext waits until Wake() or ctx.Done()
func (SimpleTrigger) Wake ¶
func (trigger SimpleTrigger) Wake()
Wake resume a goroutine calling Wait()
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
Trigger wakes up a waiting goroutine many times. The number that Wait() or WaitWithContext() is called is insured. Note that Wait() or <-trigger can be used by only one goroutine.
func (*Trigger) WaitWithContext ¶
WaitWithContext waits until trigger.Wake() or ctx.Done()