grawt

package module
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 5 Imported by: 1

README

grawt

graceful terminations for go applications

example usage

var waiter = grawt.NewWaiter()

waiter.AddCloseHandler(func() {
		nacl.FinalizeStan()
	}, false)

// blocking wait, if no need to block (with http server, for example), you can omit .Wait() call
waiter.Wait()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseHandler

type CloseHandler struct {
	Quit chan struct{}
	// contains filtered or unexported fields
}

func (*CloseHandler) Done

func (ch *CloseHandler) Done()

func (*CloseHandler) Halt

func (ch *CloseHandler) Halt(err error)

type Waiter

type Waiter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewWaiter

func NewWaiter() *Waiter

func (*Waiter) AddCloseHandler

func (w *Waiter) AddCloseHandler(f func(), waitForChannel bool) *CloseHandler

func (*Waiter) Halt

func (w *Waiter) Halt(err error)

func (*Waiter) Wait

func (w *Waiter) Wait()

Jump to

Keyboard shortcuts

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