closer

package
v0.0.0-...-1bf90d9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(f ...func() error)

Add func to global closer.

func CloseAll

func CloseAll()

CloseAll calls all closer functions.

func Wait

func Wait()

Wait blocks until all closer functions are done.

Types

type Closer

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

Closer is a global closer.

func New

func New(sig ...os.Signal) *Closer

New returns new Closer. If []os.Signal is specified Closer will automatically call CloseAll when one of signals is received from OS.

func (*Closer) Add

func (c *Closer) Add(f ...func() error)

Add func to closer.

func (*Closer) CloseAll

func (c *Closer) CloseAll()

CloseAll calls all closer functions.

func (*Closer) Wait

func (c *Closer) Wait()

Wait blocks until all closer functions are done.

Jump to

Keyboard shortcuts

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