notifier

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package notifier provides a simple signal that one goroutine can wait on and another can trigger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

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

Notifier allows waiting until Notify is called (or context is cancelled). Each Notify unblocks one Wait. Safe for concurrent use.

func New

func New() *Notifier

New returns a new Notifier.

func (*Notifier) Notify

func (n *Notifier) Notify()

Notify unblocks one waiter. Non-blocking; if no one is waiting, the next Wait will return immediately.

func (*Notifier) Wait

func (n *Notifier) Wait(ctx context.Context) error

Wait blocks until Notify is called or ctx is cancelled. Returns nil if Notify was called, otherwise ctx.Err().

Jump to

Keyboard shortcuts

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