C# Class Disruptor.SequenceGroup

A Sequence group that can dynamically have Sequences added and removed while being thread safe. The SequenceGroup.Value get and set methods are lock free and can be concurrently called with the SequenceGroup.Add and SequenceGroup.Remove.
Inheritance: ISequence
ファイルを表示 Open project: disruptor-net/Disruptor-net Class Usage Examples

Public Methods

Method Description
Add ( ISequence sequence ) : void

Add a Sequence into this aggregate. This should only be used during initialisation. Use SequenceGroup.AddWhileRunning.

AddAndGet ( long value ) : long
AddWhileRunning ( ICursored cursored, Sequence sequence ) : void

Adds a sequence to the sequence group after threads have started to publish to the Disruptor.It will set the sequences to cursor value of the ringBuffer just after adding them. This should prevent any nasty rewind/wrapping effects.

CompareAndSet ( long expectedSequence, long nextSequence ) : bool
IncrementAndGet ( ) : long
Remove ( ISequence sequence ) : bool

Remove the first occurrence of the Sequence from this aggregate.

SetValue ( long value ) : void

Set all Sequences in the group to a given value.

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.

Method Details

Add() public method

Add a Sequence into this aggregate. This should only be used during initialisation. Use SequenceGroup.AddWhileRunning.
public Add ( ISequence sequence ) : void
sequence ISequence sequence to be added to the aggregate.
return void

AddAndGet() public method

public AddAndGet ( long value ) : long
value long
return long

AddWhileRunning() public method

Adds a sequence to the sequence group after threads have started to publish to the Disruptor.It will set the sequences to cursor value of the ringBuffer just after adding them. This should prevent any nasty rewind/wrapping effects.
public AddWhileRunning ( ICursored cursored, Sequence sequence ) : void
cursored ICursored The data structure that the owner of this sequence group will be pulling it's events from
sequence Sequence The sequence to add
return void

CompareAndSet() public method

public CompareAndSet ( long expectedSequence, long nextSequence ) : bool
expectedSequence long
nextSequence long
return bool

IncrementAndGet() public method

public IncrementAndGet ( ) : long
return long

Remove() public method

Remove the first occurrence of the Sequence from this aggregate.
public Remove ( ISequence sequence ) : bool
sequence ISequence sequence to be removed from this aggregate.
return bool

SetValue() public method

Set all Sequences in the group to a given value.
public SetValue ( long value ) : void
value long value to set the group of sequences to.
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