protected virtual void Dispose(bool disposing) { _logger.LogDebug("锁开始Dispose,{Resources}", Resources); if (!_disposedValue) { if (disposing) { #pragma warning disable UnhandledExceptions // Unhandled exception(s) SingleRedisDistributedLockManager.ReleaseResourceAsync(this, _logger).Fire(); #pragma warning restore UnhandledExceptions // Unhandled exception(s) } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null //Resources = null!; ResourceValues = null !; _disposedValue = true; Status = DistributedLockStatus.Disposed; } }
/// <summary> /// DisposeAsync /// </summary> /// <param name="disposing"></param> /// <returns></returns> /// <exception cref="LockException"></exception> protected virtual async ValueTask DisposeAsync(bool disposing) { _logger.LogDebug("锁开始Dispose,{Resources}", Resources); if (!_disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects) await SingleRedisDistributedLockManager.ReleaseResourceAsync(this, _logger).ConfigureAwait(false); } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null //Resources = null!; ResourceValues = null !; _disposedValue = true; Status = DistributedLockStatus.Disposed; } }