Exemplo n.º 1
0
        public void EnqueueForWriting(ByteBlock _block)
        {
            int id = _block.ID;

            lock (locker)
            {
                if (isDead)
                {
                    throw new InvalidOperationException("Queue already stopped");
                }

                while (id != blockId)
                {
                    Monitor.Wait(locker);
                }

                queue.Enqueue(_block);
                blockId++;
                Monitor.PulseAll(locker);
            }
        }