syncutil

package
v0.0.0-...-1e0f2b1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitOrForget

func WaitOrForget(wg WaitGroup, duration ...time.Duration) bool

WaitOrForget waits for the given WaitGroup to be done or forgets about it after a given duration. Similar to the concept of "fire & forget", but waiting for some time before forgetting, and returning whether the `WaitGroup` is done or not within the duration time.

Types

type WaitGroup

type WaitGroup interface {
	Wait()
}

WaitGroup defines the behavior of a `Wait`-able object.

type WaitGroupWithCount

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

WaitGroupWithCount defines the behavior of a WaitGroup with a count.

func NewWaitGroupWithCount

func NewWaitGroupWithCount() *WaitGroupWithCount

NewWaitGroupWithCount constructs a new instance of WaitGroupWithCount.

func (*WaitGroupWithCount) Add

func (w *WaitGroupWithCount) Add(delta int)

Add adds the given delta to the count of the WaitGroupWithCount. Equivalent to sync.WaitGroup.Add, but for WaitGroupWithCount.

func (*WaitGroupWithCount) Count

func (w *WaitGroupWithCount) Count() int

Count returns the count of WaitGroupWithCount.

func (*WaitGroupWithCount) Done

func (w *WaitGroupWithCount) Done()

Done decrements the count of the WaitGroupWithCount. Equivalent to sync.WaitGroup.Done, but for WaitGroupWithCount.

func (*WaitGroupWithCount) Wait

func (w *WaitGroupWithCount) Wait()

Wait blocks until the count of the WaitGroupWithCount is zero. Equivalent to sync.WaitGroup.Wait, but for WaitGroupWithCount.

Jump to

Keyboard shortcuts

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