Channels

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoFunc

type DoFunc func(code int)

DoFunc is a function that is called when a signal is received.

Parameters:

  • code: The code of the signal.

type SignalChannel

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

SignalChannel is a channel for signals.

func NewSignalChannel

func NewSignalChannel(doFunc DoFunc) *SignalChannel

NewSignalChannel creates a new SignalChannel.

Parameters:

  • doFunc: The function to call when a signal is received.

Returns:

  • *SignalChannel: The new SignalChannel.

Behaviors:

  • If doFunc is nil, an empty function is used.

func (*SignalChannel) Close

func (sc *SignalChannel) Close()

Close closes the SignalChannel.

func (*SignalChannel) Send

func (sc *SignalChannel) Send(code int)

Send sends a signal to the SignalChannel.

Parameters:

  • code: The code of the signal.

func (*SignalChannel) Start

func (sc *SignalChannel) Start()

Start starts the SignalChannel.

func (*SignalChannel) Wait

func (sc *SignalChannel) Wait()

Wait waits for the SignalChannel to finish.

Jump to

Keyboard shortcuts

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