/// <summary> /// Returns a reader to the temp file for exclusive use. /// Release method must be called to return the reader to /// the pool when finished. /// </summary> /// <returns> /// Reader open and ready to read from the temp file. /// </returns> public Reader GetReader() { lock (_readers) { if (_readers.Count > 0) { return(_readers.Dequeue()); } } Interlocked.Increment(ref _readerCount); return(Source.CreateReader()); }
/// <summary> /// Returns a reader to the temp file for exclusive use. /// Release method must be called to return the reader to /// the pool when finished. /// </summary> /// <returns> /// Reader open and ready to read from the temp file. /// </returns> public Reader GetReader() { lock (_readers) { if (_readers.Count > 0) { var reader = _readers.Dequeue(); if (reader.BaseStream != null) { return(reader); } } } Interlocked.Increment(ref _readerCount); return(Source.CreateReader()); }