有没有人能解释一下WaitOne第二个参数的作用?

corex 2003-10-26 11:00:47
WaitHandle.WaitOne(TimeSpan, bool)
第二个参数是指在Wait之前是否退出同步域(synchronization domain),
有没能详细解说一下,究竟有什么作用吗?
...全文
264 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
老青菜 2010-05-28
  • 打赏
  • 举报
回复
唉,我也不懂,不理解、、
saucer 2003-11-04
  • 打赏
  • 举报
回复
a set of context-bound objects which share a lock (through SynchronizationAttribute) are said to be in a synchronization domain

if a client is calling any object in the synchronization domain, it needs to acquire this lock, once the lock is acquired, no other clients can access any object in the synchronization domain

If this client calls WaitOne, it has a choice to stay in the synchronization domain (with the second parameter exitContext set to false), so it will keep the lock (then no other clients can access any object in the domain during the waiting period), or it can leave the synchronization domain (with the second parameter exitContext set to true) and the system will release the lock, so other clients can access the objects in the synchronization domain
corex 2003-11-03
  • 打赏
  • 举报
回复
楼上两位说了也是白说,翻译我是会的,MSDN我看的不少。
我就是看了不明白才问。
我想问的就是什么叫"退出同步域",作用表现是怎么样,什么又叫重新获取同步域。
不好意思,这样确实不值得给分啊。
lyrixliu 2003-10-26
  • 打赏
  • 举报
回复
bool exitContext
如果在等待之前退出上下文的同步域(如果在同步上下文中),然后重新获取它,则为 true;否则为 false。
LuZhou 2003-10-26
  • 打赏
  • 举报
回复
看看msdn。

110,580

社区成员

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

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

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