Example #1
0
 internal ReadLock(ReaderWriterLock rwLock)
 {
     this.rwLock = rwLock;
     if (this.rwLock != null)
     {
         current = this;
     }
 }
Example #2
0
 /// <summary>
 /// 释放锁
 /// </summary>
 public void ReleaseLock()
 {
     if (this.rwLock != null && this.rwLock.IsReaderLockHeld)
     {
         current = null;
         this.rwLock.ReleaseReaderLock();
         this.rwLock = null;
     }
 }
Example #3
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (!this.IsDisposed)
     {
         this.IsDisposed = true;
         this.rwLock     = null;
         ReadLock.ClearCurrent();
         WriteLock.ClearCurrent();
     }
 }
Example #4
0
 /// <summary>
 /// 减少读取模式的递归计数,并在生成的计数为 0(零)时退出读取模式。
 /// </summary>
 public void ReleaseReadLock()
 {
     this.rwLock.ReleaseReaderLock();
     ReadLock.ClearCurrent();
 }
Example #5
0
 internal void Clear()
 {
     this.rwLock = null;
     current     = null;
 }