lifecycle

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 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.

Documentation

Overview

Package lifecycle owns local stop admission and synchronous cleanup joining.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lifetime

type Lifetime struct {
	// contains filtered or unexported fields
}

Lifetime separates stop signaling from cleanup. Its zero value is ready to use. Stop callbacks must not acquire locks held during I/O or wait for owned workers.

func (*Lifetime) Close

func (l *Lifetime) Close(cancel, cleanup func())

Close stops admission and runs cleanup once. Every caller waits for that same cleanup to finish, including callers arriving after shutdown has started.

func (*Lifetime) Stop

func (l *Lifetime) Stop(cancel func())

Stop seals admission and runs the cancellation callback once. It does not join workers, so an owned worker may call Stop without waiting for itself.

func (*Lifetime) Stopping

func (l *Lifetime) Stopping() bool

Stopping reports whether admission has been sealed.

Jump to

Keyboard shortcuts

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