signal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

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
}

Signal lets goroutines signal that some event has occurred. Other goroutines can wait for the signal.

func New

func New(ch chan struct{}) *Signal

New wraps a channel and turns it into a signal for a one-time event.

func (*Signal) Notify

func (s *Signal) Notify()

Notify alerts any goroutines waiting on this signal that the event has occurred. After the first call to Notify(), future calls are no-op.

func (*Signal) Wait

func (s *Signal) Wait() <-chan struct{}

Wait returns a channel which will be written to when Notify() is called for the first time. This channel will never be written to a second time.

Jump to

Keyboard shortcuts

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