我正在使用一个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.
更多推荐
发布评论