using Medallion.Threading.Internal; namespace Medallion.Threading.Postgres; /// /// Implements /// public sealed class PostgresDistributedLockHandle : IDistributedSynchronizationHandle { private IDistributedSynchronizationHandle? _innerHandle; internal PostgresDistributedLockHandle(IDistributedSynchronizationHandle innerHandle) { this._innerHandle = innerHandle; } /// /// Implements /// public CancellationToken HandleLostToken => this._innerHandle?.HandleLostToken ?? throw this.ObjectDisposed(); /// /// Releases the lock /// public void Dispose() => Interlocked.Exchange(ref this._innerHandle, null)?.Dispose(); /// /// Releases the lock asynchronously /// public ValueTask DisposeAsync() => Interlocked.Exchange(ref this._innerHandle, null)?.DisposeAsync() ?? default; }