public void ParallelAddOffsetsValue() { using (NativeLongPtr intPtr = new NativeLongPtr(Allocator.Temp, 123)) { NativeLongPtr.Parallel parallel = intPtr.GetParallel(); parallel.Add(5); Assert.That(intPtr.Value, Is.EqualTo(128)); parallel.Add(-15); Assert.That(intPtr.Value, Is.EqualTo(113)); } }
public void ParallelAddRequiresReadAccess() { using (NativeLongPtr intPtr = new NativeLongPtr(Allocator.Temp)) { NativeLongPtr.Parallel parallel = intPtr.GetParallel(); AssertRequiresReadOrWriteAccess( intPtr, () => parallel.Add(10)); } }
public void Execute(int index) { Sum.Add(Array[index]); }