/// <summary> /// Atomically set the value to the given updated value if the current value == the expected value. /// </summary> /// <param name="expectedSequence">the expected value for the sequence</param> /// <param name="newSequence">the new value for the sequence</param> /// <returns>true if successful. False return indicates that the actual value was not equal to the expected value.</returns> public virtual bool CompareAndSet(long expectedSequence, long newSequence) { return(_value.AtomicCompareExchange(newSequence, expectedSequence)); }
public void AtomicCompareExchangeReturnsTrueIfComparandEqualsCurrentValue() { Assert.IsTrue(_volatile.AtomicCompareExchange(NewValue, InitialValue)); }