protected override void RemoveItem(int index) { var item = this[index]; base.RemoveItem(index); OnDequeue?.Invoke(item); }
void OnProcessQueue() { int max = _Queue.Count; if (max <= 0) { return; } object[] ls = new object[max]; for (int x = 0; x < max; x++) { object o; if (_Queue.TryDequeue(out o)) { ls[x] = o; } } try { OnDequeue?.Invoke(this, ls); } catch (Exception ex) { Console.WriteLine(ex.ToString()); //foreach (object o in ls) _Queue.Enqueue(o); } }
void OnProcessQueue() { if (GeoLite2LocationProvider.Current == null) { #if DEBUG ///TODO: Config the default GeoIp GeoLite2LocationProvider.LoadCurrent( @"D:\Fuentes\Xploit\Resources\GeoLite2\Small\GeoLite2-Blocks-IP.csv.gz", @"D:\Fuentes\Xploit\Resources\GeoLite2\Small\GeoLite2-City-Locations-es.csv.gz"); #endif } Parallel.For(0, _Queue.Count, (i) => { object o; if (_Queue.TryDequeue(out o)) { try { OnDequeue?.Invoke(this, o); } catch (Exception ex) { _Queue.Enqueue(o); } } }); }
void Dequeue() { NumberWaiting--; Console.WriteLine($"{ClockTime}\t{GetType().Name}#{Index}\tDequeue. #Waiting: {NumberWaiting}"); if (NumberWaiting == Capacity - 1) { ChangeAccessibility(); } OnDequeue.Invoke(); }
public new bool TryDequeue(out T result) { bool succ = base.TryDequeue(out T item); result = item; if (succ) { OnDequeue?.Invoke(this, item); } return(succ); }
public FixedSizeDictionary(int count) { queue = new FixedSizedQueue <T> (count) { OnDequeue = (key) => { if (dictionary.TryGetValue(key, out var value)) { dictionary.Remove(key); OnDequeue?.Invoke(new KeyValuePair <T, T1> (key, value)); } } }; }
public void Step(int dTime) { if (!mIsDisposed && mCache != default) { if (mCache != default)//执行处理中的队列 { int max = mCache.Count; if (max > 0) { Current = mCache.Dequeue(); OnDequeue?.Invoke(dTime, Current); } } } Current = default; }
public T Dequeue() { if (head == null) { throw new InvalidOperationException("Queue is empty"); } var res = head.Value; var nextHead = head.Next; head = nextHead; if (nextHead == null) { tail = null; } Count--; OnDequeue?.Invoke(this); return(res); }
public T Dequeue() { if (_count == 0) { return(null); } var dequeued = _head; _head = _head.next; _count--; if (_count != 0) { _head.prev.next = null; _head.prev = null; } OnDequeue?.Invoke(dequeued.value); return(dequeued.value); }
public void Update(int dTime) { if (!mIsDisposed) { mCache = mIsFront ? mCacheBack : mCacheFront; //切换到需要处理的队列 mEnqueueCache = mIsFront ? mCacheFront : mCacheBack; if (mCache != default) //执行处理中的队列 { int max = mCache.Count; if (max > 0) { while (mCache.Count > 0) { Current = mCache.Dequeue(); OnDequeue?.Invoke(dTime, Current); } } } mIsFront = !mIsFront; } Current = default; }
public void Update(int dTime) { mCachesTemp = mCache;//设置处理中的的队列 if (!mIsDisposed && mCachesTemp != default) { mCache = mIsFront ? mCacheBack : mCacheFront; //切换队列 if (mCachesTemp != default) //执行处理中的队列 { int max = mCachesTemp.Count; if (max > 0) { while ((mCachesTemp != default) && (mCachesTemp.Count > 0)) { Current = mCachesTemp.Dequeue(); OnDequeue?.Invoke(dTime, Current); } } } mIsFront = !mIsFront; } Current = default; mCachesTemp = default; }
public void Dequeue() { NumberWaiting--; Console.WriteLine($"{ClockTime}\t{GetType().Name}\tDequeue. #Waiting: {NumberWaiting}"); OnDequeue.Invoke(); }