Inheritance: IDisposable
示例#1
0
 public CompositionLock(bool isThreadSafe)
 {
     this._isThreadSafe = isThreadSafe;
     if (isThreadSafe)
     {
         this._stateLock = new Lock();
     }
 }
示例#2
0
        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);
            }
        }
示例#3
0
 public ReadLock(Lock @lock)
 {
     this._isDisposed = 0;
     this._lock       = @lock;
     this._lock.EnterReadLock();
 }