xsync

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond

type Cond struct {
	L sync.Locker
	// contains filtered or unexported fields
}

Cond is similar to sync.Cond: Conditional variable implementation that uses channels for notifications. This implementation differ from sync.Cond in following ways: - Only supports Broadcast - Wait with ctx that can be cancelled see sync.Cond for usage Ref: https://gist.github.com/zviadm/c234426882bfc8acba88f3503edaaa36#file-cond2-go

func NewCond

func NewCond(l sync.Locker) *Cond

func (*Cond) Broadcast

func (c *Cond) Broadcast()

Broadcast call notifies everyone that something has changed.

func (*Cond) Wait

func (c *Cond) Wait(ctx context.Context) (err error)

Wait for Broadcast calls. Similar to regular sync.Cond, this unlocks the underlying locker first, waits on changes and re-locks it before returning.

Jump to

Keyboard shortcuts

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