public void New_TryPop_Push_x33_TryPop_x33_TryPop_Count() { int value; var q = new WorkStealingDeque <int>(); Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); for (int i = 0; i < 33; ++i) { q.Push(100 - i); } Assert.AreEqual(33, q.Count); for (int i = 32; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); }
private void QueueWorkItem(Action callback) { // NOTE (steveb): this method MUST be called from the dispatcher's associated thread // increase work-item counter and enqueue item _inbox.Push(callback); }
public void New_TryPop_Push_x32_TryPop_x32_TryPop_Count() { object value; var q = new WorkStealingDeque <object>(); Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); for (int i = 0; i < 32; ++i) { q.Push(100 - i); } Assert.AreEqual(32, q.Count); for (int i = 31; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); }
public void New_Push_Count() { var q = new WorkStealingDeque<int>(); Assert.AreEqual(0, q.Count); q.Push(42); Assert.AreEqual(1, q.Count); }
public void New_Push_Count() { var q = new WorkStealingDeque <int>(); Assert.AreEqual(0, q.Count); q.Push(42); Assert.AreEqual(1, q.Count); }
public void New_Push_TryPop_Count() { int value; var q = new WorkStealingDeque<int>(); Assert.AreEqual(0, q.Count); q.Push(42); Assert.AreEqual(1, q.Count); q.TryPop(out value); Assert.AreEqual(42, value); Assert.AreEqual(0, q.Count); }
public void New_TryPop_Push_Count() { int value; var q = new WorkStealingDeque <int>(); Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); q.Push(42); Assert.AreEqual(1, q.Count); }
public void New_Push_x50_Count() { int value; var q = new WorkStealingDeque<int>(); Assert.AreEqual(0, q.Count); for(int i = 0; i < 50; ++i) { q.Push(100 - i); } Assert.AreEqual(50, q.Count); for(int i = 49; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); }
public void New_Push_x50_TryPop_x50_Count() { int value; var q = new WorkStealingDeque <int>(); Assert.AreEqual(0, q.Count); for (int i = 0; i < 50; ++i) { q.Push(100 - i); } Assert.AreEqual(50, q.Count); for (int i = 49; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); }
public void New_TryPop_Push_x33_TryPop_x33_TryPop_Count() { int value; var q = new WorkStealingDeque<int>(); Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); for(int i = 0; i < 33; ++i) { q.Push(100 - i); } Assert.AreEqual(33, q.Count); for(int i = 32; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); }
public void New_TryPop_Push_x32_TryPop_x32_TryPop_Count() { object value; var q = new WorkStealingDeque<object>(); Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); for(int i = 0; i < 32; ++i) { q.Push(100 - i); } Assert.AreEqual(32, q.Count); for(int i = 31; i >= 0; --i) { q.TryPop(out value); Assert.AreEqual(100 - i, value); } Assert.AreEqual(0, q.Count); q.TryPop(out value); Assert.AreEqual(0, q.Count); }