public CompositionLock(bool isThreadSafe) { this._isThreadSafe = isThreadSafe; if (isThreadSafe) { this._stateLock = new Lock(); } }
protected override void Dispose(bool disposing) { try { if (disposing) { Lock disposeLock = null; if (!this._isDisposed) { using (new WriteLock(this._lock)) { if (!this._isDisposed) { this._isDisposed = true; disposeLock = this._lock; this._lock = null; this._packages = null; this._loadedAssemblies = null; this._parts = null; this._partsQuery = null; } } } if (disposeLock != null) { disposeLock.Dispose(); } } } finally { base.Dispose(disposing); } }
public ReadLock(Lock @lock) { this._isDisposed = 0; this._lock = @lock; this._lock.EnterReadLock(); }