sync

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 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.

func (*Closer) WithCallback

func (c *Closer) WithCallback(cb func()) *Closer

WithCallback adds additional logic to be triggered on the closure of the Closer

Jump to

Keyboard shortcuts

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