terminate

package module
v0.0.0-...-d486fe7 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 6 Imported by: 4 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址