Question

According to MSDN, the purpose of ManualResetEvent's Reset() method is -

Sets the state of the event to nonsignaled, causing threads to block.

What thread(s) does it block ? The calling thread or the current one or any other ?

Thanks in advance.

Was it helpful?

Solution

It blocks the threads calling WaitOne() on the wait handle (the ManualResetEvent)

OTHER TIPS

A ManualResetEvent is class that you can use to synchronize threads. If you wanted one thread to wait for another to finish for example, you can have the the thread you want to finish first call Reset and the second call WaitOne. WaitOne will block the second thread. When the first thread finishes, you will want to call Set which will cause the blocking WaitOne on the second thread to return hence allowing the second thread to finish.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top