/// <summary> /// Add a <see cref="Sequence"/> into this aggregate. This should only be used during /// initialisation. Use <see cref="SequenceGroup.AddWhileRunning(Cursored, Sequence)"/> /// </summary> /// <param name="sequence"></param> public void Add(Sequence sequence) { Sequence[] oldSequences; Sequence[] newSequences; do { oldSequences = sequencesRef.ReadFullFence(); var oldSize = oldSequences.Length; newSequences = new Sequence[oldSize + 1]; Array.Copy(oldSequences, newSequences, oldSize); newSequences[oldSize] = sequence; }while (!sequencesRef.AtomicCompareExchange(newSequences, oldSequences)); }
public void ReadFullFenceReturnsInitialValue() { Assert.AreEqual(_initialValue, _volatile.ReadFullFence()); }
public long GetMinimumSequence() { return(Util.GetMinimumSequence(sequencesRef.ReadFullFence(), cursor.Value)); }