Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RegistrationOpts ¶
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
Waiter is a simple primitive to wait for a signal asynchronously. It is preferred over other sync primitives due to having more sensible defaults such as built-in timeouts if the signal does not appear and ability to signal more than once without panicking.
func NewWaiter ¶
func NewWaiter() *Waiter
NewWaiter returns a generic struct which can be waited on until `Waiter.Finish` is called. A Waiter is similar to a `sync.WaitGroup` of size 1, but without the ability to underflow and with built-in timeouts.
func (*Waiter) Finish ¶
func (w *Waiter) Finish()
Finish will cause all goroutines waiting via Wait to stop waiting and return. Once this function has been called, subsequent calls to Wait will return immediately. To begin waiting again, make a new Waiter.