notify

package
v0.0.0-...-a345a4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier provides a one-to-many notification mechanism

func (*Notifier) Close

func (n *Notifier) Close()

Close closes the notify and stops all receiver in this notifier Note we must `Close` the notifier if we can't ensure each receiver of this notifier is called `Stop` in order to prevent goroutine leak.

func (*Notifier) NewReceiver

func (n *Notifier) NewReceiver(tickTime time.Duration) (*Receiver, error)

NewReceiver creates a receiver returns a channel to receive notifications and a function to close this receiver

func (*Notifier) Notify

func (n *Notifier) Notify()

Notify sends a signal to the Receivers

type Receiver

type Receiver struct {
	C <-chan struct{}

	Stop func()
	// contains filtered or unexported fields
}

Receiver is a receiver of notifier, including the receiver channel and stop receiver function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL