signal

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package signal provides mechanism for notifying multiple listeners when something happened.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signal

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

A Signal is used to let multiple listeners know when something happened.

func New

func New() *Signal

New creates a new Signal.

func (*Signal) Bind

func (s *Signal) Bind() chan struct{}

Bind creates a new listening channel bound to the signal. The channel used has a size of 1 and any given broadcast will signal at least one event, but may signal more than one.

func (*Signal) Broadcast

func (s *Signal) Broadcast()

Broadcast signals all the listeners. Broadcast never blocks.

func (*Signal) Unbind

func (s *Signal) Unbind(ch chan struct{})

Unbind stops the listening channel bound to the signal.

Jump to

Keyboard shortcuts

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