Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pointer ¶
type Pointer[T any] struct { // contains filtered or unexported fields }
Pointer is a wrapper around the standard atomic.Pointer[T] for Go 1.19+. This provides a consistent API across Go versions.
func NewPointer ¶
NewPointer returns a new Pointer[T] initialized with the given value.
func (*Pointer[T]) CompareAndSwap ¶
CompareAndSwap performs a compare-and-swap operation on the pointer atomically. It stores new in the pointer if the current value is equal to old. It returns true if the swap was performed, false otherwise.
func (*Pointer[T]) Load ¶
func (x *Pointer[T]) Load() *T
Load returns the value stored in the pointer atomically.
Click to show internal directories.
Click to hide internal directories.