如何找到什么状态ManualResetEvent?(How to find what state ManualResetEvent is in?)

编程入门 行业动态 更新时间:2024-10-26 22:27:19
如何找到什么状态ManualResetEvent?(How to find what state ManualResetEvent is in?)

我正在使用一个ManualResetEvent的实例来控制对资源的线程访问,但是我遇到了问题。 有人知道我在调试过程中能找到什么样的状态?

也就是说我想知道ManualResetEvent当前是否阻止任何线程,甚至可能会阻塞多少个线程。

I am using an instance of ManualResetEvent to control thread access to a resource but I'm running into problems with it. Does anyone know how I can find out during debugging what the state of the object is?

That is to say I would like to know if the ManualResetEvent is currently blocking any threads and maybe even how many and which threads it is blocking.

最满意答案

对超时值为零的事件执行WaitOne 。

如果事件被设置,它将返回true,如果发生超时则返回false。 换句话说,设置true - >事件,false - >事件未设置。

Perform a WaitOne on the event with a timeout value of zero.

It will return true if the event is set, or false if the timeout occurs. In other words, true -> event is set, false -> event is not set.

更多推荐

本文发布于:2023-08-04 23:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1423183.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   ManualResetEvent   state   find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!