closer

package
v0.0.0-...-d867389 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 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 adds `func() error` callback to the globalCloser

func CloseAll

func CloseAll()

CloseAll ...

func Wait

func Wait()

Wait ...

Types

type Closer

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

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