Documentation ¶
Overview ¶
Package waiter - Wait for a broadcast
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Waiter ¶
type Waiter[T any] struct { // contains filtered or unexported fields }
Waiter makes it easy to wait for a broadcast. This is a bit like a sync.Cond, but easier to use. A waiter must not be copied after first use.
func (*Waiter[T]) AlwaysBroadcast ¶
func (w *Waiter[T]) AlwaysBroadcast(e T)
AlwaysBroadcast broadcasts e to all current waiters and saves it such that every new waiter also receives e. This is useful for fatal errors. Calls to AlwaysBroadcast after the first call to AlwaysBroadcast will not update the value returned to waiters.
func (*Waiter[T]) Broadcast ¶
func (w *Waiter[T]) Broadcast(e T)
Broadcast broadcasts e to all current waiters and closes their underlying channels. If AlwaysBroadcast has been called, Broadcast is a no-op.
Click to show internal directories.
Click to hide internal directories.