Hello. Who can explain the purpose of the ManualRestEvent class? I don't understand what the functions do:
- Set ()
- WaitOn ()
- Reset ()
Hello. Who can explain the purpose of the ManualRestEvent class? I don't understand what the functions do:
ManualResetEvent allows threads to communicate with each other by passing signals. Usually, this interaction concerns a task that one thread must complete before the other continues.
When a thread begins work, which must be completed before other threads continue, it calls the Reset method to place the ManualResetEvent in a non-alarm state. This thread can be understood as controlling ManualResetEvent. Threads that call the WaitOne method in the ManualResetEvent will be blocked waiting for a signal. When the controlling thread has completed its work, it will call the Set method to indicate that the waiting threads can continue. All pending threads are released.
in other words, if we called WaitOne , the thread will stop working until the Set method of the same object is called. Reset "cocks" all WaitOne again.
is cross processor
references:
Reset () - Sets the non-signal state of the event, causing blocking of threads.
Set () - Sets the alarm state of an event, allowing one or more waiting threads to continue.
WaitOne () - Blocks the current stream until the WaitHandle object receives a signal.
Source: https://ru.stackoverflow.com/questions/41543/
All Articles