public void OnEvent(FizzBuzzEvent @event, long sequence, bool endOfBatch) { switch (_fizzBuzzStep) { case FizzBuzzStep.Fizz: @event.Fizz = (@event.Value % 3) == 0; break; case FizzBuzzStep.Buzz: @event.Buzz = (@event.Value % 5) == 0; break; case FizzBuzzStep.FizzBuzz: if (@event.Fizz && @event.Buzz) { _fizzBuzzCounter.WriteUnfenced(_fizzBuzzCounter.ReadUnfenced() + 1); } break; } //System.Console.WriteLine(sequence); if (sequence == _iterations) { _mru.Set(); } }
public void OnEvent(FizzBuzzEvent @event, long sequence, bool endOfBatch) { switch (_fizzBuzzStep) { case FizzBuzzStep.Fizz: //if (@event.Value % 3 == 0) @event.Fizz = @event.Value % 3 == 0; break; case FizzBuzzStep.Buzz: // if (@event.Value % 5 == 0) @event.Buzz = @event.Value % 5 == 0; break; case FizzBuzzStep.FizzBuzz: if (@event.Fizz && @event.Buzz) { fizzBuzzCounter.WriteUnfenced(fizzBuzzCounter.ReadUnfenced() + 1); } break; } if (_mru != null && count == sequence) { _mru.Set(); } }
public void OnEvent(FunctionEvent @event, long sequence, bool endOfBatch) { switch (_functionStep) { case FunctionStep.One: @event.StepOneResult = @event.OperandOne + @event.OperandTwo; break; case FunctionStep.Two: @event.StepTwoResult = @event.StepOneResult + 3L; break; case FunctionStep.Three: if ((@event.StepTwoResult & 4L) == 4L) { _stepThreeCounter.WriteUnfenced(_stepThreeCounter.ReadUnfenced() + 1); } break; } if (sequence == _iterations - 1) { _mru.Set(); } }
public void OnEvent(ValueEvent @event, long sequence, bool endOfBatch) { value.WriteUnfenced(operation.Op(value.ReadUnfenced(), @event.Value)); if (count == sequence) { latch.Signal(); } }
public void OnEvent(ValueEvent @event, long sequence, bool endOfBatch) { _value.WriteUnfenced(_operation.Op(_value.ReadUnfenced(), @event.Value)); if (sequence == _iterations - 1) { _latch.Signal(); } }
public void OnEvent(ValueEvent @event, long sequence, bool endOfBatch) { _value.WriteUnfenced(_value.ReadUnfenced() + @event.Value); if (sequence == _iterations - 1) { _mru.Set(); } }
public void OnEvent(ValueEvent @event, long sequence, bool endOfBatch) { _value.WriteUnfenced(_value.ReadUnfenced() + @event.Value); if (_iterations == sequence) { _mru.Signal(); } }
public void OnEvent(FunctionEvent @event, long sequence, bool endOfBatch) { //switch (functionStep) //{ // case FunctionStep.One: // @event.StepOneResult = @event.OperandOne + @event.OperandTwo; // break; // case FunctionStep.Two: // @event.StepTwoResult = @event.StepOneResult + 3L; // break; // case FunctionStep.Three: // if ((@event.StepTwoResult & 4L) == 4L) // { // stepThreeCounter.WriteUnfenced(stepThreeCounter.ReadUnfenced() + 1L); // } // break; //} //if (latch != null && count == sequence) //{ // latch.Set(); //} switch (functionStep) { case FunctionStep.One: @event.StepOneResult = @event.OperandOne + @event.OperandTwo; break; case FunctionStep.Two: @event.StepTwoResult = @event.StepOneResult + 3L; break; case FunctionStep.Three: if ((@event.StepTwoResult & 4L) == 4L) { stepThreeCounter.WriteUnfenced(stepThreeCounter.ReadUnfenced() + 1); } break; } if (latch != null && sequence == count) { latch.Set(); } }
public void OnEvent(ValueEvent @event, long sequence, bool endOfBatch) { _value.WriteUnfenced(_value.ReadUnfenced() + @event.Value); if (localSequence + 1 == sequence) { localSequence = sequence; } else { Console.WriteLine("Expected: " + (localSequence + 1) + "found: " + sequence); } if (count == sequence) { latch.Set(); } }
public void ReadUnfencedReturnsInitialValue() { Assert.AreEqual(InitialValue, _volatile.ReadUnfenced()); }