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."); } }
/// <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(); }