signal

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.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 ActivityChecker

type ActivityChecker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

periodically check if there is any activity in the past t(a time) by receiving from the channel, if there is no, run the onInactive(); if there is, go on some goroutines will ReportActivity using the channel

func NewActivityChecker

func NewActivityChecker(onInactive func(), timeout time.Duration) *ActivityChecker

func (*ActivityChecker) Cancel

func (t *ActivityChecker) Cancel()

does not call Finish()

func (*ActivityChecker) Finish

func (t *ActivityChecker) Finish()

func (*ActivityChecker) SetTimeout

func (t *ActivityChecker) SetTimeout(timeout time.Duration)

func (*ActivityChecker) Update

func (t *ActivityChecker) Update()

type Notifier

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

Notifier is a utility for notifying changes. The change producer may notify changes multiple time, and the consumer may get notified asynchronously.

func NewNotifier

func NewNotifier() *Notifier

NewNotifier creates a new Notifier.

func (*Notifier) Signal

func (n *Notifier) Signal()

Signal signals a change, usually by producer. This method never blocks.

func (*Notifier) Wait

func (n *Notifier) Wait() <-chan struct{}

Wait returns a channel for waiting for changes. The returned channel never gets closed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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