shutdown

package
v0.0.0-...-7c4ed6d Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package shutdown provides a mechanism for registering handlers to be called on process shutdown.

Index

Constants

View Source
const GracePeriod = 1 * time.Minute

GracePeriod specifies the maximum amount of time during which all shutdown handlers must complete before the process forcibly exits.

Variables

This section is empty.

Functions

func Handle

func Handle(onShutdown func())

Handle registers the onShutdown function to be run when the system is being shut down. On shutdown, registered functions are run in last-in-first-out order. Handle may be called concurrently.

func Now

func Now(code int)

Now calls all registered shutdown closures in last-in-first-out order and terminates the process with the given status code. It only executes once and guarantees termination within GracePeriod. Now may be called concurrently.

Types

This section is empty.

Jump to

Keyboard shortcuts

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