C# Класс 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.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
GetIndex ( ) : int

Описание методов

Counter() публичный Метод

Creates a new Counter with an initial value of zero.
public Counter ( ) : System
Результат System

Counter() публичный Метод

Creates a new Counter with an initial value of startingValue.
public Counter ( int startingValue ) : System
startingValue int The initial value for the .
Результат System

Decrement() публичный Метод

Atomically decrements the Counter by one.
public Decrement ( ) : void
Результат void

Increment() публичный Метод

Atomically increments the Counter by one.
public Increment ( ) : void
Результат void

operator() публичный статический Метод

Atomically increments counter by one.
public static operator ( ) : Counter
Результат Counter