Is it possible to check the blocking state for C# System.Threading.AutoResetEvent or
System.Threading.ManualResetEvent before calling WaitOne() ?
Is it possible to check the blocking state for C# System.Threading.AutoResetEvent or System.Threading.ManualResetEvent before
Share
An EventWaitHandle doesn’t have a “blocking state”. It is set or reset, nothing else. And no, you cannot check that any other way than by calling WaitOne().
You can pass a 0 for the time-out argument to avoid blocking. That’s often a very bad idea because it says nothing about the state of the event after the WaitOne() call returns. It might have changed a nanosecond after that. This causes a very nasty kind of bug called “threading race”. A Heisenbug.