CheckTimeout() static private method

static private CheckTimeout ( TimeSpan timeout ) : int
timeout TimeSpan
return int
Example #1
0
 /// <summary>Tries to enter the lock in upgradeable mode, with an optional time-out.</summary>
 /// <returns>true if the calling thread entered upgradeable mode, otherwise, false.</returns>
 /// <param name="timeout">The interval to wait, or -1 milliseconds to wait indefinitely.</param>
 /// <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The current thread initially entered the lock in read mode, and therefore trying to enter upgradeable mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter. The limit is so large that applications should never encounter it.</exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative, but it is not equal to -1 milliseconds, which is the only negative value allowed.-or-The value of <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception>
 public bool TryEnterUpgradeableReadLock(TimeSpan timeout)
 {
     return(this.TryEnterUpgradeableReadLock(ReaderWriterLockSlim.CheckTimeout(timeout)));
 }