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