Documentation
¶
Overview ¶
Package xsync provides synchronization utilities. It is an extension to the standard sync package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Future ¶
type Future[T any] struct { // contains filtered or unexported fields }
Future is a container for a value that may not yet be available.
func (*Future[T]) Ready ¶
func (a *Future[T]) Ready() <-chan struct{}
Ready returns a channel that is closed when the value becomes available.
type Latch ¶ added in v0.20.1
type Latch struct {
// contains filtered or unexported fields
}
Latch is a synchronization primitive that allows multiple goroutines to wait until the latch is set. Latches cannot be reset.
func (*Latch) Chan ¶ added in v0.20.1
func (l *Latch) Chan() <-chan struct{}
Chan returns a channel that is closed when the latch is set.
type Observable ¶ added in v0.20.1
type Observable[T any] struct { // contains filtered or unexported fields }
Observable is an atomic value that can be observed for changes.
func (*Observable[T]) Load ¶ added in v0.20.1
func (o *Observable[T]) Load() (T, <-chan struct{})
Load returns the current value and a channel that is closed when that is replaced by a subsequent call to Store.
func (*Observable[T]) Store ¶ added in v0.20.1
func (o *Observable[T]) Store(v T)
Store updates the value.
type SucceedOnce ¶
type SucceedOnce struct {
// contains filtered or unexported fields
}
SucceedOnce is a sync.Once variant that allows for the operation to fail.