atomicx

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package atomicx implements misc atomic functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxInt32

func MaxInt32(a *int32, b int32)

MaxInt32 performs an atomic Max operation: a = max(a, b)

Types

type Counter

type Counter int64

Counter implements a basic atomic int64 counter.

func (*Counter) Add

func (a *Counter) Add(inc int64) int64

Add adds to counter.

func (*Counter) Dec

func (a *Counter) Dec() int64

Dec decrements by 1.

func (*Counter) Inc

func (a *Counter) Inc() int64

Inc increments by 1.

func (*Counter) Set

func (a *Counter) Set(val int64)

Set sets the counter to a new value.

func (*Counter) Sub

func (a *Counter) Sub(dec int64) int64

Sub subtracts from counter.

func (*Counter) Swap

func (a *Counter) Swap(val int64) int64

Swap swaps a new value in and returns the old value.

func (*Counter) Value

func (a *Counter) Value() int64

Value returns the current value.

Jump to

Keyboard shortcuts

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