public void TestsEnqueue() { if (LinkedQueue.IsEmpty != true) { throw new System.Exception("IsEmpty Not True"); } if (LinkedQueue.Count != 0) { throw new System.Exception("Count Not 0"); } LinkedQueue.Enqueue(LastInputOutput++); if (LinkedQueue.IsEmpty != false) { throw new System.Exception("IsEmpty Not False"); } if (LinkedQueue.Count != 1) { throw new System.Exception("Count Not 1"); } if (LinkedQueue.First == null) { throw new System.Exception("First is null"); } if (LinkedQueue.Last == null) { throw new System.Exception("Last is null"); } if (false == LinkedQueue.TryEnqueue(ref LastInputOutput)) { throw new System.Exception("TryEnqueue Not True"); } if (LinkedQueue.IsEmpty != false) { throw new System.Exception("IsEmpty Not False"); } if (LinkedQueue.Count != 2) { throw new System.Exception("Count Not 2"); } if (LinkedQueue.First == null) { throw new System.Exception("First is null"); } if (LinkedQueue.Last == null) { throw new System.Exception("Last is null"); } }
public bool Add(System.Action action) { if (object.ReferenceEquals(action, null)) { return(false); } System.Tuple <System.Action, ThreadPriorityInformation, System.TimeSpan> Item = new System.Tuple <System.Action, ThreadPriorityInformation, System.TimeSpan>(action, UnderlyingThreadsPriorityInformation, System.Threading.Timeout.InfiniteTimeSpan); while (Itinerarius.TryEnqueue(ref Item).Equals(false) && UpdateTokenSource.IsCancellationRequested.Equals(false)) { while (System.Threading.Thread.Yield()) { System.Threading.Thread.CurrentThread.Join(); } } return(true); }
// ClassInterface<IStamp> public bool Add(System.Tuple <PacketStamp, Common.MemorySegment> data) { return(Queue.TryEnqueue(ref data)); }