public void Execute(int i) { if (i % 2 > 0) { counter.TryIncrement(int.MaxValue); } else { counter.TryDecrement(int.MinValue); } }
public void NativeLimitedCounter_Allocate_Deallocate_Read_Write() { var c = new NativeLimitedCounter(Allocator.Persistent); int cnt = 0; for (var i = 0; i < 100; ++i) { c.TryIncrement(100 /* max */); ++cnt; } Assert.AreEqual(cnt, c.Count); c.Dispose(); }
public void NativeLimitedCounter_IncrementDecrement() { const int MAX = 1000; var counter = new NativeLimitedCounter(Allocator.Persistent); for (var i = 0; i < MAX / 2; ++i) { counter.TryIncrement(MAX); } var job = new Job2(); job.counter = counter; job.Schedule(MAX, 32).Complete(); Assert.AreEqual(MAX / 2, counter.Count); counter.Dispose(); }
public void Execute(int i) { counter.TryIncrement(maximum); }
public void Execute(int i) { bool success = counter.TryIncrement(maximum); Assert.IsTrue(success); }