Ejemplo n.º 1
0
        internal static ReadLockScope Create(ReaderWriterLockSlim readerWriterLock)
        {
            if (readerWriterLock == null)
            {
                throw new ArgumentNullException("readerWriterLock");
            }
            ReadLockScope readLockScope = new ReadLockScope(readerWriterLock);

            readLockScope.Acquire();
            return(readLockScope);
        }
Ejemplo n.º 2
0
 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);
 }