terminate

package
v0.0.0-...-10febd9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2017 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

README

go-terminate

GoDoc

Utility class used to terminate go services in a controlled manor.

Usage

import (
    "log"

    "github.com/pulcy/go-terminate"
    )

func main() {
    t := terminate.NewTerminator(log.Printf, nil)
    go t.ListenSignals()
    ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Terminator

type Terminator struct {
	ExitCode    int
	OsExitDelay time.Duration
	// contains filtered or unexported fields
}

func NewTerminator

func NewTerminator(logger func(template string, args ...interface{}), onClosing func()) *Terminator

NewTerminator creates and initialized a new Terminator. Call ListenSignals on the returned instances to perform its magic.

func (*Terminator) ListenSignals

func (t *Terminator) ListenSignals()

ListenSignals waits for incoming OS signals and acts upon them

Jump to

Keyboard shortcuts

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