cancelclose

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnCancel

func OnCancel(ctx context.Context, resource Closer) func()

OnCancel registers context-triggered closure of resource and returns a cleanup function that closes the resource and waits for any active cancellation callback to complete before returning.

Types

type Closer

type Closer interface {
	io.Closer
}

Closer represents a resource whose Close method is safe for concurrent and repeated invocations, such as net.Conn and net.Listener.

Jump to

Keyboard shortcuts

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