简体   繁体   English

如何判断ManualResetEvent是否已发出信号或未发出信号?

[英]How can I tell if a ManualResetEvent is signaled or non-signaled?

I want to check to see if an instance of ManualResetEvent is signaled before starting a thread. 我想在启动线程之前检查是否发出了ManualResetEvent实例的信号。 How can I do this? 我怎样才能做到这一点?

You can use WaitOne with a timeout of zero. 您可以使用WaitOne ,超时为零。 Either way, the function will return immediately and you can use the return value to determine whether the event was signalled or not. 无论哪种方式,函数都会立即返回,您可以使用返回值来确定事件是否已发出信号。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#绑定:如何在BindingList中禁用CurrencyManager,以便不维护当前项位置并且不发信号? - C# Binding: How can I disable the CurrencyManager in BindingList so Current Item position is not maintained and not signaled? 是否有一些可以用信号通知/未用信号通知的同步对象以及一个值? - Is there some synchronization object that can be signaled/nonsignalled plus a value? 我可以跨程序集使用 ManualResetEvent 吗? - Can I use ManualResetEvent across assemblies? 我的EventWaithandle出了点问题,它不会变为已发出信号吗? - Something is going wrong with my EventWaithandle, it doesn't change to signaled? 为什么未引发OutputDataReceived以进行提示,从而阻止了AutoResetEvent的信号发出? - Why is OutputDataReceived not being raised for prompt, preventing AutoResetEvent from being signaled? 我可以在此ManualResetEvent中使用锁来确保线程安全吗? - Can I use a lock with this ManualResetEvent to ensure thread safety? 避免在收到信号之前在服务器的内存中读取大量用户提交的表单数据? - Avoid Reading Huge User Submitted Form Data in Server's Memory until signaled? 为什么Monitor.PulseAll会在信号线程中产生“踩台阶”延迟模式? - Why does Monitor.PulseAll result in a “stepping stair” latency pattern in signaled threads? 如何从Universal应用程序中的ManualResetEvent中获取回调? - How do I get a callback from a ManualResetEvent in a Universal app? waitany(Array)实际上是“设置”一个事件,还是只是返回一个信号事件的索引 - Does waitany(Array) actually 'set' a event, or does it just return the index of a signaled event
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM