util

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signaler

type Signaler struct {
	C chan struct{}
	// contains filtered or unexported fields
}

Signaler allows for multiple writers to safely signal an event so that reader on the channel C would get unblocked

func NewSignaler

func NewSignaler() *Signaler

NewSignaler initializes a new obj

func (*Signaler) Signal

func (s *Signaler) Signal()

Signal safely closes the blocking channel

type WaitingCounter added in v1.17.0

type WaitingCounter atomic.Int32

A WaitingCounter waits for a counter to go to zero.

func (*WaitingCounter) Add added in v1.17.0

func (r *WaitingCounter) Add(c int32)

Add increments the counter. As opposed to sync.WaitGroup, it is safe to be called after Wait has been called.

func (*WaitingCounter) Done added in v1.17.0

func (r *WaitingCounter) Done()

Done decrements the counter. If the counter goes bellow zero a panic will be raised.

func (*WaitingCounter) Wait added in v1.17.0

func (r *WaitingCounter) Wait(waitFor time.Duration) int

Wait blocks waiting for the counter value to reach zero or for the timeout to be reached. Is guaranteed to wait for at least a hundred milliseconds regardless of given duration if the counter is positive value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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