Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top