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