atomiccounter

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package atomiccounter implements a basic atomic int64 counter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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