channel

package
v5.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Outlet

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

Outlet struct is used to be passed to an object which needs an outlet

The difference between signal and done channel is as following:

  • signal channel can be added through SetSignal and is used to interrupt events sent through OnEventSignal-
  • done channel is used to close and stop the outlet

If SetSignal is used, it must be ensure that there is only one event producer.

func NewOutlet

func NewOutlet(
	done <-chan struct{},
	c chan *input.Event,
	wg *sync.WaitGroup,
) *Outlet

func (*Outlet) OnEvent

func (o *Outlet) OnEvent(event *input.Event) bool

func (*Outlet) OnEventSignal

func (o *Outlet) OnEventSignal(event *input.Event) bool

OnEventSignal can be stopped by the signal that is set with SetSignal This does not close the outlet. Only OnEvent does close the outlet. If OnEventSignal is used, it must be ensured that only one producer is used.

func (*Outlet) SetSignal

func (o *Outlet) SetSignal(signal <-chan struct{})

SetSignal sets the signal channel for OnEventSignal If SetSignal is used, it must be ensure that only one producer exists.

Jump to

Keyboard shortcuts

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