x

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSafeMultiCloser

func NewSafeMultiCloser(closers ...io.Closer) io.Closer

NewSafeMultiCloser returns an io.Closer which ensures the that calling Close() on it calls Close() on each of the provided io.Closer(s) exactly once. Subsequent calls are not executed.

Types

type SafeCloser added in v1.2.0

type SafeCloser interface {
	io.Closer
	Reset(closer io.Closer)
}

SafeCloser is a reuesable safe closer.

func NewSafeCloser

func NewSafeCloser(x io.Closer) SafeCloser

NewSafeCloser returns a io.Closer which ensures the underlying Close() is only called once. It's useful for cleanup of resources in functions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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