closeflag

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorClosed is returned when the object is closed multiple times
	ErrorClosed = errors.New("CloseFlag was already closed. This is harmless.")
)

Functions

This section is empty.

Types

type CloseFlag

type CloseFlag struct {

	// CloseFunc will be called the first time Close is called. It is allowed to call Close itself
	CloseFunc func() error
	// contains filtered or unexported fields
}

CloseFlag is a simple object that has a close function that closes a channel and can be called many times

func (*CloseFlag) Chan

func (c *CloseFlag) Chan() <-chan (struct{})

Chan returns a channel that will be closed upon closing the CloseFlag

func (*CloseFlag) Close

func (c *CloseFlag) Close() error

Close closes the CloseFlag. It can safely be called multiple times

func (*CloseFlag) IsClosed

func (c *CloseFlag) IsClosed() bool

IsClosed returns if the flag was already closed

Jump to

Keyboard shortcuts

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