예제 #1
0
        internal static WriteLockScope Create(ReaderWriterLockSlim readerWriterLock)
        {
            if (readerWriterLock == null)
            {
                throw new ArgumentNullException("readerWriterLock");
            }
            WriteLockScope writeLockScope = new WriteLockScope(readerWriterLock);

            writeLockScope.Acquire();
            return(writeLockScope);
        }
예제 #2
0
 internal WriteLockScope Upgrade()
 {
     if (base.IsDisposed)
     {
         throw new ObjectDisposedException(base.GetType().Name);
     }
     if (!this.lockChanged && !this.upgradeableReadLockExited)
     {
         this.lockChanged = true;
         return(WriteLockScope.Create(base.ScopedReaderWriterLock));
     }
     return(null);
 }