sync

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Waker

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

Waker is used to wake up a sleeper when some event occurs. It debounces multiple wakeup calls occurring between each sleep, and wakeups are non-blocking to avoid having to coordinate goroutines.

func NewWaker

func NewWaker() *Waker

NewWaker creates a new Waker.

func (*Waker) Close

func (w *Waker) Close() error

Close closes the waker and cleans up its resources

func (*Waker) Sleep

func (w *Waker) Sleep() <-chan struct{}

Sleep returns a channel that blocks until Wake() is called.

func (*Waker) Wake

func (w *Waker) Wake()

Wake wakes up the sleeper.

func (*Waker) WakeAfter

func (w *Waker) WakeAfter(delay time.Duration)

WakeAfter wakes up the sleeper after some delay.

Jump to

Keyboard shortcuts

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