glue: github.com/desertbit/glue/backend/closer Index | Files

package closer

import "github.com/desertbit/glue/backend/closer"

Emit a close function only once, also if called multiple times. This implementation is thread-safe.

Index

Package Files

closer.go

type Closer Uses

type Closer struct {
    // Channel which is closed if the closer is closed.
    IsClosedChan chan struct{}
    // contains filtered or unexported fields
}

func New Uses

func New(f func()) *Closer

New creates a new closer. The passed function is emitted only once, as soon close is called.

func (*Closer) Close Uses

func (c *Closer) Close()

Close calls the function and sets the IsClosed boolean.

func (*Closer) IsClosed Uses

func (c *Closer) IsClosed() bool

IsClosed returns a boolean whenever this closer is already closed.

Package closer imports 1 packages (graph) and is imported by 3 packages. Updated 2016-08-01. Refresh now. Tools for package owners.