C# Class Ariadne.Counter

A counter designed for highly concurrent use.
This counter tends to be appreciably slower than using Interlocked.Increment(ref int) when there is little contention. However, it is much faster in the face of contending threads, with the comparable cost of Interlocked.Increment(ref int) increasing nearly exponentially to the number of contending threads.
Afficher le fichier Open project: JonHanna/Ariadne

Méthodes publiques

Méthode Description
Counter ( ) : System

Creates a new Counter with an initial value of zero.

Counter ( int startingValue ) : System

Creates a new Counter with an initial value of startingValue.

Decrement ( ) : void

Atomically decrements the Counter by one.

Increment ( ) : void

Atomically increments the Counter by one.

operator ( ) : Counter

Atomically increments counter by one.

Private Methods

Méthode Description
GetIndex ( ) : int

Method Details

Counter() public méthode

Creates a new Counter with an initial value of zero.
public Counter ( ) : System
Résultat System

Counter() public méthode

Creates a new Counter with an initial value of startingValue.
public Counter ( int startingValue ) : System
startingValue int The initial value for the .
Résultat System

Decrement() public méthode

Atomically decrements the Counter by one.
public Decrement ( ) : void
Résultat void

Increment() public méthode

Atomically increments the Counter by one.
public Increment ( ) : void
Résultat void

operator() public static méthode

Atomically increments counter by one.
public static operator ( ) : Counter
Résultat Counter