private async Task <bool> ValidateUpgradeAsync(Task <bool> upgradeTask, TimeSpan?timeout)
 {
     if (!await upgradeTask.ConfigureAwait(false))
     {
         throw DistributedLockHelpers.CreateTryAcquireFailedException(timeout);
     }
     return(true);
 }
 /// <summary>
 /// Upgrades to a WRITE lock synchronously. Not compatible with another WRITE lock or a UPGRADE lock
 /// </summary>
 public bool UpgradeToWriteLock(TimeSpan?timeout = null, CancellationToken cancellationToken = default)
 {
     if (!this.TryUpgradeToWriteLock(timeout ?? Timeout.InfiniteTimeSpan, cancellationToken))
     {
         throw DistributedLockHelpers.CreateTryAcquireFailedException(timeout);
     }
     return(true);
 }