In C # multithreaded programming, these two classes are almost indispensable, their usage / declaration is very similar, so where is it?
The SET method sets the signal to the Send Status RESET method to set the signal as the transmission of the Waitone waiting signal.
In fact, from the name, you can see a little, one manual, an automatic, this manual and automatic actual refers to the processing of the reset method, as described below.
Public AutoreteEvent Autoevent (New AutoreteTevent (TRUE);
Public ManualReveTevent Manualevent = New ManualReveTevent (TRUE);
The default signal is in the send state,
Autoevent.waitone ();
ManualEvent.waitone ();
If a thread calls the above method, the thread will be signal when the signal is in the transmission state, resulting in continuing
After the difference is called, Autoevent.Waitone () only allows only one thread to enter, when a thread gets the signal (that is, there are other thread calls)
After the autoevent.set () method, AutoEvent will automatically set the signal without sending, then other call waitone threads continue to wait. That is, Autoevent only wakes up a thread at a time.
Manualevent can wake up multiple threads because when a thread calls the SET method, other call waitone thread gets the signal to continue execution, and ManualEvent will not automatically set the signal. That is, unless manual calls MANUALEVENT.RESET (). Method
ManualEvent will always remain signal state, and Manualevent can also wake up multiple threads at the same time.