gvisorgvisor.dev/gvisor/pkg/sync/atomicptr Index | Files

package seqatomic

import "gvisor.dev/gvisor/pkg/sync/atomicptr"

Package seqatomic doesn't exist. This file must be instantiated using the go_template_instance rule in tools/go_generics/defs.bzl.

Index

Types

type AtomicPtr

type AtomicPtr struct {
	// contains filtered or unexported fields
}

An AtomicPtr is a pointer to a value of type Value that can be atomically loaded and stored. The zero value of an AtomicPtr represents nil.

Note that copying AtomicPtr by value performs a non-atomic read of the stored pointer, which is unsafe if Store() can be called concurrently; in this case, do `dst.Store(src.Load())` instead.

+stateify savable

func (*AtomicPtr) Load

func (p *AtomicPtr) Load() *Value

Load returns the value set by the most recent Store. It returns nil if there has been no previous call to Store.

func (*AtomicPtr) Store

func (p *AtomicPtr) Store(x *Value)

Store sets the value returned by Load to x.

func (*AtomicPtr) Swap

func (p *AtomicPtr) Swap(x *Value) *Value

Swap atomically stores `x` into *p and returns the previous *p value.

type Value

type Value struct{}

Value is a required type parameter.

Source Files

generic_atomicptr_unsafe.go

Version
v0.0.0-20250508033829-06acafc42203 (latest)
Published
May 8, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
7 hours ago

Tools for package owners.