public override void Enqueue(T1 item, int millisecondsTimeout) { using (ChoBarrier highBarrier = ChoBarrier.HighBarrier(_barrier)) { if (!highBarrier.Wait(millisecondsTimeout)) { throw new ChoQueueTimeoutException(); } _queue.Enqueue(item); } }
public override T1 Dequeue(int millisecondsTimeout) { using (ChoBarrier lowBarrier = ChoBarrier.LowBarrier(_barrier)) { if (!lowBarrier.Wait(millisecondsTimeout)) { throw new ChoQueueTimeoutException(); } T1 item = _queue.Dequeue(); return(item); } }
internal ChoBlockingQueue(ChoQueue <T1> queue, int size) { this._queue = queue; this._size = size; this._barrier = new ChoBarrier(0, size); }