Пример #1
0
        internal T Dequeue()
        {
            T lret = null;

            lock (myQueues)
            {
TryNextQueue:
                if (myCurrent == null && myQueues.Count > 0)
                {
                    myCurrent = myQueues.Dequeue();
                }

                // No more queues available
                if (myCurrent == null)
                {
                    return(lret);
                }

                // get next element or null if no more elements are in the queue
                lret = myCurrent.Dequeue();
                if (lret == null)
                {
                    myCurrent = null;
                    goto TryNextQueue;
                }
            }

            return(lret);
        }
Пример #2
0
            public bool MoveNext()
            {
                bool lret = true;

                myCurrentFile = myResultQueue.Dequeue();
                if (myCurrentFile == null)
                {
                    lret = false;
                }
                return(lret);
            }
Пример #3
0
        void ThreadWriter()
        {
            try
            {
                while (true)
                {
                    T item = myQueue.Dequeue();
                    myWriter(item);

                    if (item == null)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                myLastException = ex;
            }
        }