sync

package
Version: v0.35.9 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.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 Closer

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

Closer implements a primitive to close a channel that signals process termination while allowing a caller to call Close multiple times safely. It should be used in cases where guarantees cannot be made about when and how many times closure is executed.

func NewCloser

func NewCloser() *Closer

NewCloser returns a reference to a new Closer.

func (*Closer) Close

func (c *Closer) Close()

Close gracefully closes the Closer. A caller should only call Close once, but it is safe to call it successive times.

func (*Closer) Done

func (c *Closer) Done() <-chan struct{}

Done returns the internal done channel allowing the caller either block or wait for the Closer to be terminated/closed.

type Mutex

type Mutex struct {
	sync.Mutex
}

A Mutex is a mutual exclusion lock.

type RWMutex

type RWMutex struct {
	sync.RWMutex
}

An RWMutex is a reader/writer mutual exclusion lock.

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) 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.

Jump to

Keyboard shortcuts

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