示例#1
0
        public long?GetWritePosition(int blockNumber)
        {
            PositionParameter curParam = GetParameter(blockNumber);

            if (curParam.PostionToWrite == null)
            {
                curParam.WriterSync.WaitOne();
            }
            return(curParam.PostionToWrite);
        }
示例#2
0
        public long?GetReadPosition(int blockNumber)
        {
            PositionParameter curParam = GetParameter(blockNumber);

            if (curParam.PostionToRead == null)
            {
                curParam.ReaderSync.WaitOne();
            }
            return(curParam.PostionToRead);
        }
示例#3
0
        public void DoReport(int blockNumber, bool forRead, long count)
        {
            PositionParameter curItem  = GetParameter(blockNumber);
            PositionParameter nextItem = GetParameter(blockNumber + 1);

            if (forRead)
            {
                nextItem.PostionToRead = curItem.PostionToRead + count;
            }
            else
            {
                nextItem.PostionToWrite = curItem.PostionToWrite + count;
                lock (_locker)
                {
                    _positions.Remove(blockNumber);
                }
            }
        }