Documentation ¶
Index ¶
- func MapSyncValue[T any, U any](sv *SyncVal[T], f func(T) (U, error)) (U, error)
- type Array
- type Bool
- type Guard
- type Int
- func (ai *Int) AddAndGet(delta int) int
- func (ai *Int) Clone() Int
- func (ai *Int) CloneAndSet(value int) Int
- func (ai *Int) CompareAndSet(expect int, update int) bool
- func (ai *Int) DecrementAndGet() int
- func (ai *Int) Get() int
- func (ai *Int) GetAndAdd(delta int) int
- func (ai *Int) GetAndDecrement() int
- func (ai *Int) GetAndIncrement() int
- func (ai *Int) GetAndSet(newValue int) int
- func (ai *Int) GomegaString() string
- func (ai *Int) IncrementAndGet() int
- func (ai *Int) Set(newValue int)
- func (ai *Int) String() string
- type Queue
- type SyncVal
- type TypedVal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array implement a fixed width array with atomic semantics
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool implements a synchronized boolean value
func (*Bool) CompareAndToggle ¶
CompareAndToggle atomically sets the boolean value if the current value is equal to updated value.
func (*Bool) GomegaString ¶
GomegaString implements the GomegaStringer interface to prevent race conditions in tests
type Guard ¶ added in v7.7.0
type Guard[T any] struct { // contains filtered or unexported fields }
Guard allows synchronized access to a value
func (*Guard[T]) Do ¶ added in v7.7.0
func (g *Guard[T]) Do(f func(*T))
Do calls the passed closure.
func (*Guard[T]) DoVal ¶ added in v7.7.0
func (g *Guard[T]) DoVal(f func(T))
DoVal calls the passed closure with a dereferenced internal value.
func (*Guard[T]) InitDo ¶ added in v7.7.0
func (g *Guard[T]) InitDo(init func() *T, f func(*T))
Calls the passed closure allowing to replace the content. It will call the init func if the internal values is nil.
func (*Guard[T]) InitDoVal ¶ added in v7.7.0
func (g *Guard[T]) InitDoVal(init func() T, f func(T))
Calls the passed closure allowing to replace the content. It will call the init func if the internal values is nil. It is used for reference values like slices and maps.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int implements an int value with atomic semantics
func (*Int) Clone ¶
CloneAndSet atomically clones the atomic Int and sets the value to the given updated value.
func (*Int) CloneAndSet ¶
CloneAndSet atomically clones the atomic Int and sets the value to the given updated value.
func (*Int) CompareAndSet ¶
CompareAndSet atomically sets the value to the given updated value if the current value == expected value. Returns true if the expectation was met
func (*Int) DecrementAndGet ¶
DecrementAndGet atomically decrements current value by one and returns the result.
func (*Int) GetAndAdd ¶
GetAndAdd atomically adds the given delta to the current value and returns the result.
func (*Int) GetAndDecrement ¶
GetAndDecrement atomically decrements the current value by one and returns the result.
func (*Int) GetAndIncrement ¶
GetAndIncrement atomically increments current value by one and returns the result.
func (*Int) GetAndSet ¶
GetAndSet atomically sets current value to the given value and returns the old value.
func (*Int) GomegaString ¶
GomegaString implements the GomegaStringer interface to prevent race conditions during tests
func (*Int) IncrementAndGet ¶
IncrementAndGet atomically increments current value by one and returns the result.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a non-blocking FIFO queue. If the queue is empty, nil is returned. if the queue is full, offer will return false
type SyncVal ¶
type SyncVal[T any] struct { // contains filtered or unexported fields }
SyncVal allows synchronized access to a value
func NewSyncVal ¶
NewSyncVal creates a new instance of SyncVal
func (*SyncVal[T]) GetSyncedVia ¶
GetSyncedVia returns the value returned by the function f.