atomicutil

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package atomicutil contains functions for working with the atomic package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

Value is a generic atomic.Value.

func NewValue

func NewValue[T any](init T) *Value[T]

NewValue creates a new Value.

func (*Value[T]) CompareAndSwap added in v0.29.0

func (v *Value[T]) CompareAndSwap(old, new T) bool

Swap swaps the value atomically.

func (*Value[T]) Load

func (v *Value[T]) Load() T

Load loads the value atomically.

func (*Value[T]) Store

func (v *Value[T]) Store(val T)

Store stores the value atomically.

func (*Value[T]) Swap added in v0.29.0

func (v *Value[T]) Swap(val T) T

Swap swaps the value atomically.

Jump to

Keyboard shortcuts

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