AutoResetEvent.WaitOne(int,bool)的线程同步问题

yhwebus 2004-03-18 01:27:35
我想知道第二个参数究竟做什么控制的,看了下面的介绍,还是不清楚,有人能帮忙解释下吗?


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.
...全文
297 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
MuseIn 2004-09-08
  • 打赏
  • 举报
回复
我也在学习这个

111,111

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧