Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of the <see cref="AsyncDoubleBufferedQueue{T}"/> class.
        /// </summary>
        public AsyncDoubleBufferedQueue()
        {
            m_asyncQueue          = new AsyncQueue <IEnumerable <T> >();
            m_doubleBufferedQueue = new DoubleBufferedQueue <T>();

            m_asyncQueue.ProcessItemFunction        = item => m_doubleBufferedQueue.Enqueue(item);
            m_asyncQueue.ProcessException          += (sender, args) => OnProcessException(args.Argument);
            m_doubleBufferedQueue.ProcessException += (sender, args) => OnProcessException(args.Argument);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Produces a collection of items to be processed by the consumer.
        /// </summary>
        /// <param name="items">The collection of items to be enqueued.</param>
        public void Produce(IEnumerable <T> items)
        {
            DoubleBufferedQueue <T> queue = m_queue;

            if ((object)queue != null)
            {
                m_queue.Enqueue(items);
                m_manager.SignalItemHandler();
            }
        }