Example #1
0
            public override void Enqueue(T1 item, int millisecondsTimeout)
            {
                using (ChoBarrier highBarrier = ChoBarrier.HighBarrier(_barrier))
                {
                    if (!highBarrier.Wait(millisecondsTimeout))
                    {
                        throw new ChoQueueTimeoutException();
                    }

                    _queue.Enqueue(item);
                }
            }
Example #2
0
            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);
                }
            }