public long?GetWritePosition(int blockNumber) { PositionParameter curParam = GetParameter(blockNumber); if (curParam.PostionToWrite == null) { curParam.WriterSync.WaitOne(); } return(curParam.PostionToWrite); }
public long?GetReadPosition(int blockNumber) { PositionParameter curParam = GetParameter(blockNumber); if (curParam.PostionToRead == null) { curParam.ReaderSync.WaitOne(); } return(curParam.PostionToRead); }
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); } } }