public static bool WaitOne(WaitHandle waitHandle, TimeSpan timeout) { TimeoutHelper.ThrowIfNegativeArgument(timeout); if (timeout != TimeSpan.MaxValue) { return(waitHandle.WaitOne(timeout, false)); } else { waitHandle.WaitOne(); return(true); } }
public IOThreadCancellationTokenSource(TimeSpan timeout) { TimeoutHelper.ThrowIfNegativeArgument(timeout); this.timeout = timeout; }
public static void ThrowIfNegativeArgument(TimeSpan timeout) { TimeoutHelper.ThrowIfNegativeArgument(timeout, "timeout"); }