notifier

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataNotifier

type DataNotifier[T any] struct {
	// contains filtered or unexported fields
}

func NewDataNotifier

func NewDataNotifier[T any]() *DataNotifier[T]

func (*DataNotifier[T]) Notify

func (dn *DataNotifier[T]) Notify(d T)

func (*DataNotifier[T]) Wait

func (dn *DataNotifier[T]) Wait() *LazyData[T]

type LazyData

type LazyData[T any] struct {
	// contains filtered or unexported fields
}

func NewLazyData

func NewLazyData[T any]() *LazyData[T]

func (*LazyData[T]) Data

func (ld *LazyData[T]) Data() T

func (*LazyData[T]) Ready

func (ld *LazyData[T]) Ready() <-chan struct{}

type Notifier

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

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) Notify

func (n *Notifier) Notify()

func (*Notifier) Wait

func (n *Notifier) Wait() <-chan struct{}

type SafeClose

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

func NewSafeClose

func NewSafeClose() *SafeClose

func (*SafeClose) Attach

func (s *SafeClose) Attach(f func(done func(), closeSignal <-chan struct{}))

Attach add this goroutine to s.wg CloseWait. f must receive closeSignal and call done when it is done. If s was closed, f will not run.

func (*SafeClose) CloseWait

func (s *SafeClose) CloseWait()

CloseWait sends a close signal to SafeClose and wait until it is closed. It is concurrent safe and can be called multiple times. CloseWait blocks until s.Done() is called and all Attach-ed goroutines is done.

func (*SafeClose) Done

func (s *SafeClose) Done()

Done notifies CloseWait that is done. It is concurrent safe and can be called multiple times.

func (*SafeClose) Err

func (s *SafeClose) Err() error

Err returns the first SendCloseSignal error.

func (*SafeClose) ReceiveCloseSignal

func (s *SafeClose) ReceiveCloseSignal() <-chan struct{}

func (*SafeClose) SendCloseSignal

func (s *SafeClose) SendCloseSignal(err error)

SendCloseSignal sends a close signal.

Jump to

Keyboard shortcuts

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