pump

package
v0.0.0-...-2824937 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT, BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package pump provides an infinitely buffered event channel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pump

type Pump struct {
	// contains filtered or unexported fields
}

Pump is an event pump, such that calling Send(e) will eventually send e on the event channel, in order, but Send will always complete soon, even if nothing is receiving on the event channel. It is effectively an infinitely buffered channel.

In particular, goroutine A calling p.Send will not deadlock even if goroutine B that's responsible for receiving on p.Events() is currently blocked trying to send to A on a separate channel.

func Make

func Make() Pump

Make returns a new Pump. Call Release to stop pumping events.

func (*Pump) Events

func (p *Pump) Events() <-chan interface{}

Events returns the event channel.

func (*Pump) Release

func (p *Pump) Release()

Release stops the event pump. Pending events may or may not be delivered on the event channel. Calling Release will not close the event channel.

func (*Pump) Send

func (p *Pump) Send(event interface{})

Send sends an event on the event channel.

Jump to

Keyboard shortcuts

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