Help us shape the future of Go! Take the 2026 Go Developer Survey

lifecycle

package
v1.10.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 2 Imported by: 0

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