C# Class Disruptor.Sequence

Cache line padded sequence counter. Can be used across threads without worrying about false sharing if a located adjacent to another counter in memory.
Mostrar archivo Open project: disruptor-net/Disruptor-net Class Usage Examples

Public Methods

Method Description
AddAndGet ( long value ) : long

Increments the sequence and stores the result, as an atomic operation.

CompareAndSet ( long expectedSequence, long nextSequence ) : bool

Atomically set the value to the given updated value if the current value == the expected value.

IncrementAndGet ( ) : long

Increments the sequence and stores the result, as an atomic operation.

Sequence ( long initialValue = InitialCursorValue ) : System.Runtime.InteropServices

Construct a new sequence counter that can be tracked across threads.

SetValue ( long value ) : void

Perform an ordered write of this sequence. The intent is a Store/Store barrier between this write and any previous store.

SetValueVolatile ( long value ) : void

Performs a volatile write of this sequence. The intent is a Store/Store barrier between this write and any previous write and a Store/Load barrier between this write and any subsequent volatile read.

ToString ( ) : string

Value of the Sequence as a String.

Method Details

AddAndGet() public method

Increments the sequence and stores the result, as an atomic operation.
public AddAndGet ( long value ) : long
value long
return long

CompareAndSet() public method

Atomically set the value to the given updated value if the current value == the expected value.
public CompareAndSet ( long expectedSequence, long nextSequence ) : bool
expectedSequence long the expected value for the sequence
nextSequence long the new value for the sequence
return bool

IncrementAndGet() public method

Increments the sequence and stores the result, as an atomic operation.
public IncrementAndGet ( ) : long
return long

Sequence() public method

Construct a new sequence counter that can be tracked across threads.
public Sequence ( long initialValue = InitialCursorValue ) : System.Runtime.InteropServices
initialValue long initial value for the counter
return System.Runtime.InteropServices

SetValue() public method

Perform an ordered write of this sequence. The intent is a Store/Store barrier between this write and any previous store.
public SetValue ( long value ) : void
value long The new value for the sequence.
return void

SetValueVolatile() public method

Performs a volatile write of this sequence. The intent is a Store/Store barrier between this write and any previous write and a Store/Load barrier between this write and any subsequent volatile read.
public SetValueVolatile ( long value ) : void
value long
return void

ToString() public method

Value of the Sequence as a String.
public ToString ( ) : string
return string