// Returns a synchronized Queue. Returns a synchronized wrapper // class around the queue - the caller must not use references to the // original queue. // //[HostProtection(Synchronization = true)] public static DateTimeQueue <T> Synchronized(DateTimeQueue <T> queue) { if (queue == null) { throw new ArgumentNullException(nameof(queue)); } return(new SynchronizedDateTimeQueue <T>(queue)); }
internal DateTimeQueueEnumerator(DateTimeQueue <T> q) { _q = q; _version = _q._version; _index = 0; currentElement = _q._array; if (_q._size == 0) { _index = -1; } }
public virtual Object Clone() { DateTimeQueue <T> q = new DateTimeQueue <T>(_size) { _size = _size, _version = _version }; int numToCopy = _size; int firstPart = _array.Length - _head < numToCopy ? _array.Length - _head : numToCopy; Array.Copy(_array, _head, q._array, 0, firstPart); numToCopy -= firstPart; if (numToCopy > 0) { Array.Copy(_array, 0, q._array, _array.Length - _head, numToCopy); } return(q); }
internal SynchronizedDateTimeQueue(DateTimeQueue <T> q) : base(q) { this._q = q; root = _q.SyncRoot; }