示例#1
0
 private void UpdateDisposeSuspendState()
 {
     try
     {
         bool nonChildLocksExists = !Locks.All(x => x is IxInstanceChildLock);
         SetDisposeSuspended(nonChildLocksExists);
         if (!nonChildLocksExists && ProviderNode.AutoDisposeEnabled)
         {
             DisposeAsync();
         }
     }
     catch (InvalidOperationException)
     {
         Critical.Assert(false, "Cannot set lock, self dispose was started.");
     }
 }
示例#2
0
        /// <inheritdoc/>
        protected override void OnDisposeStarted()
        {
            // We are under tree lock here
            // ---------------------------------------------------------

            // This method is not reenterant.
            // ---------------------------------------------------------
            _locks.ForEach(x => x.PulseDispose());

            if (Locks.All(x => x is IxInstanceChildLock))
            {
                SetDisposeSuspended(false);
            }

            base.OnDisposeStarted();
        }