/// <summary> /// Acquires an UPGRADE lock asynchronously, failing with <see cref="TimeoutException"/> if the attempt times out. Not compatible with another UPGRADE lock or a WRITE lock. Usage: /// <code> /// await using (await myLock.AcquireUpgradeableReadLockAsync(...)) /// { /// /* we have the lock! */ /// } /// // dispose releases the lock /// </code> /// </summary> /// <param name="timeout">How long to wait before giving up on the acquisition attempt. Defaults to <see cref="Timeout.InfiniteTimeSpan"/></param> /// <param name="cancellationToken">Specifies a token by which the wait can be canceled</param> /// <returns>A <see cref="SqlDistributedReaderWriterLockUpgradeableHandle"/> which can be used to release the lock</returns> public ValueTask <SqlDistributedReaderWriterLockUpgradeableHandle> AcquireUpgradeableReadLockAsync(TimeSpan?timeout = null, CancellationToken cancellationToken = default) => DistributedLockHelpers.AcquireUpgradeableReadLockAsync(this, timeout, cancellationToken);