Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Strobe ¶
type Strobe[T any] struct { // contains filtered or unexported fields }
Strobe is an emitter that allows broadcasting messages by channel fan-out.
Example ¶
sb := New[string]() w := &sync.WaitGroup{} listenPrinter := func(l <-chan string) { fmt.Println(<-l) w.Done() } w.Add(3) ctx, cancel := context.WithCancel(context.Background()) defer cancel() go listenPrinter(sb.Listener(ctx)) go listenPrinter(sb.Listener(ctx)) go listenPrinter(sb.Listener(ctx)) sb.Pulse("PING") w.Wait()
Output: PING PING PING
Click to show internal directories.
Click to hide internal directories.