/// <summary> /// When overridden in a derived class, blocks the current thread until the current instance receives a signal, using a TimeSpan to measure the time interval and specifying whether to exit the synchronization domain before the wait. /// </summary> /// <param name="timeout">A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param> /// <param name="notApplicableOnCE">Just pass false</param> /// <returns>true if the current instance receives a signal; otherwise, false.</returns> public bool WaitOne(TimeSpan timeout, bool notApplicableOnCE) { return(NativeMethods.WaitForSingleObject(this.Handle, WaitHandle2.ToTimeoutMilliseconds(timeout)) != NativeMethods.WAIT_TIMEOUT); }
public static bool Wait(object obj, TimeSpan timeout) => Wait(obj, WaitHandle2.ToTimeoutMilliseconds(timeout));
public bool Wait(TimeSpan timeout) => Wait(WaitHandle2.ToTimeoutMilliseconds(timeout));
public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken) => TryEnter(obj, WaitHandle2.ToTimeoutMilliseconds(timeout), ref lockTaken);