Documentation
¶
Index ¶
Constants ¶
View Source
const TIMEOUT_SECONDS float64 = 1
Variables ¶
This section is empty.
Functions ¶
func OnShutdown ¶
func OnShutdown(key string, f func())
Receives functions to run as goroutines on shutdown. If f is nil, the function registered under key is removed. If the shutdown has already started, the function will be run immediately. As such, it is idiomatic to use `defer shutdown.OnShutdown("key", func() { ... })` to ensure the function isn't run too early.
func Shutdown ¶
Returns true if and only if the shutdown was requested by this call. If false, we were already shutting down. Calls logFunc(reason) if and only if the shutdown was requested by this call.
func WaitForShutdown ¶
func WaitForShutdown()
Blocks until shutdown is requested, but only on the first call. Subsequent calls have no effect and return immediately.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.