public override void Dispose() { // NOTE that despite the use of Interlocked here, this class is not thread-safe var innerHandle = Interlocked.Exchange(ref this.baseHandle, null); if (innerHandle != null) { // sp_getapplock must be exited for each time it is entered this.upgradedHandle?.Dispose(); innerHandle.Dispose(); this.@lock = null; } }
public InternalUpgradeableHandle(SqlDistributedReaderWriterLock @lock, IDisposable baseHandle) { this.@lock = @lock; this.baseHandle = baseHandle; }