counter

package
v0.0.0-...-e081c89 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package counter provides a thread safe counter using mutexes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MutexCounter

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

MutexCounter is a thread-safe counter

func (*MutexCounter) Add

func (mc *MutexCounter) Add() int

Add increments the counter by 1

func (*MutexCounter) NotEqual

func (mc *MutexCounter) NotEqual(i int) bool

NotEqual tests if the counters value is the same as the supplied value

func (*MutexCounter) Set

func (mc *MutexCounter) Set(i int)

Set redefines the counter to a specified value

Jump to

Keyboard shortcuts

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