سؤال

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.

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top