示例#1
0
 /// <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);
 }
示例#2
0
 public static bool Wait(object obj, TimeSpan timeout)
 => Wait(obj, WaitHandle2.ToTimeoutMilliseconds(timeout));
示例#3
0
 public bool Wait(TimeSpan timeout) => Wait(WaitHandle2.ToTimeoutMilliseconds(timeout));
示例#4
0
 public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken)
 => TryEnter(obj, WaitHandle2.ToTimeoutMilliseconds(timeout), ref lockTaken);