AutoResetEvent.WaitOne(int,bool)的线程同步问题
我想知道第二个参数究竟做什么控制的,看了下面的介绍,还是不清楚,有人能帮忙解释下吗?
WaitHandle.WaitOne Method (Int32, Boolean)
When overridden in a derived class, blocks the current thread until the current WaitHandle receives a signal, using 32-bit signed integer to measure the time interval and specifying whether to exit the synchronization domain before the wait.
[C#]
public virtual bool WaitOne(
int millisecondsTimeout,
bool exitContext)
Parameters----
millisecondsTimeout :
The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
exitContext :
true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
Return Value-----
true if the current instance receives a signal; otherwise, false.