Exemple #1
0
        private void ProcessRows(MemoryMappedViewAccessor accessor)
        {
            UInt32 lastPos = 0;

            _BlockCount = accessor.ReadUInt16(8);
            _BlockSize = accessor.ReadUInt16(10);

            while (true)
            {
                UInt32 curPos = accessor.ReadUInt32(4) % _BlockCount;

                var bag = _MissingItems;
                _MissingItems = new ConcurrentBag<int>();

                int temp = 0;
                while (bag.TryTake(out temp))
                    readLineAndProcess(accessor, temp);

                if (lastPos == curPos)
                {
                    System.Threading.Thread.Sleep(1000);
                }
                else
                {
                    if (lastPos < curPos)
                    {
                        for (UInt32 x = lastPos; x < curPos; ++x)
                            readLineAndProcess(accessor, (int)x);
                    }
                    else
                    {
                        for (UInt32 x = lastPos; x < _BlockCount; ++x)
                            readLineAndProcess(accessor, (int)x);

                        for (UInt32 x = 0; x < curPos; ++x)
                            readLineAndProcess(accessor, (int)x);
                    }

                    lastPos = curPos;
                }
            };
        }