internal static ReadLockScope Create(ReaderWriterLockSlim readerWriterLock) { if (readerWriterLock == null) { throw new ArgumentNullException("readerWriterLock"); } ReadLockScope readLockScope = new ReadLockScope(readerWriterLock); readLockScope.Acquire(); return(readLockScope); }
internal ReadLockScope Downgrade() { if (base.IsDisposed) { throw new ObjectDisposedException(base.GetType().Name); } if (!this.lockChanged && !this.upgradeableReadLockExited) { this.lockChanged = true; ReadLockScope result = ReadLockScope.Create(base.ScopedReaderWriterLock); this.Release(); return(result); } return(null); }