public void Enqueue(object item) { _queue.EnqueueBlocking(item); int count = Interlocked.Increment(ref _itemCount); if ( _overThreshold != null ) { if ( count == _upperBound ) { _overThreshold.BeginInvoke( count, new AsyncCallback(OnAsyncCallEnd), _overThreshold ); } } }
public object Dequeue() { object item = _queue.DequeueBlocking(); int count = Interlocked.Decrement(ref _itemCount); if ( _underThreshold != null ) { if ( count == _lowerBound ) { _underThreshold.BeginInvoke( count, new AsyncCallback(OnAsyncCallEnd), _underThreshold ); } } return item; }