Exemplo n.º 1
0
 internal WriteLockScope(SafeReaderWriterLock owner)
 {
     try
     {
     }
     finally
     {
         owner.EnterWriteLock();
         this.owner = owner;
     }
 }
Exemplo n.º 2
0
 internal MultipleWriteLocksScope(SafeReaderWriterLock a, SafeReaderWriterLock b)
 {
     try
     {
     }
     finally
     {
         SafeReaderWriterLock.EnterMultipleWriteLocks(a, b);
         this.a = a;
         this.b = b;
     }
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     try
     {
     }
     finally
     {
         if (this.owner != null)
         {
             this.owner.ExitWriteLock();
             this.owner = null;
         }
     }
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     try
     {
     }
     finally
     {
         if ((this.a != null) && (this.b != null))
         {
             SafeReaderWriterLock.ExitMultipleWriteLocks(this.a, this.b);
             this.a = null;
             this.b = null;
         }
     }
 }
Exemplo n.º 5
0
 public static void ExitMultipleReadLocks(SafeReaderWriterLock a, SafeReaderWriterLock b)
 {
     Validate.Begin().IsNotNull <SafeReaderWriterLock>(a, "a").IsNotNull <SafeReaderWriterLock>(b, "b").Check();
     Thread.BeginCriticalRegion();
     if (a.id == b.id)
     {
         a.ExitReadLock();
     }
     else if (a.id < b.id)
     {
         a.ExitReadLock();
         b.ExitReadLock();
     }
     else
     {
         b.ExitReadLock();
         a.ExitReadLock();
     }
     Thread.EndCriticalRegion();
 }
Exemplo n.º 6
0
 public static MultipleWriteLocksScope UseMultipleWriteLocks(SafeReaderWriterLock a, SafeReaderWriterLock b) =>
 new MultipleWriteLocksScope(a, b);