Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
 public void ParallelAddRequiresReadAccess()
 {
     using (NativeLongPtr intPtr = new NativeLongPtr(Allocator.Temp))
     {
         NativeLongPtr.Parallel parallel = intPtr.GetParallel();
         AssertRequiresReadOrWriteAccess(
             intPtr,
             () => parallel.Add(10));
     }
 }
Beispiel #3
0
 public void Execute(int index)
 {
     Sum.Add(Array[index]);
 }