
"AutoResetEvent" and "ManualResetEvent" are threading concepts which help us to manage synchronization using events/ signals. For instance let's say you have two threads as shown in the figure
http://www.dotnetinterviewquestions.in/contentpics/auto1.jpg . So by using these two concepts you can make one thread wait and when the other thread finishes processing he can signal the second thread to start from where he has halted.
Below are some differents:-
1. An AutoResetEvent resets when the code passes through event.WaitOne(), but a ManualResetEvent does not. This means that It's like the difference between a tollbooth and a door. The ManualResetEvent is the door, which needs to be closed (reset). The AutoResetEvent is a tollbooth, allowing one car to go by and automatically closing before the next one can get through.
2. When we use "AutoResetEvent" for every wait one we need a "Set" to revoke. In "ManualResetEvent" once we can the "Set" , all "WaitOne" will execute until we call "Close".
You can see the
http://www.dotnetinterviewquestions.in/contentpics/auto2.jpg Image.
Others Links:-
http://www.codeproject.com/Articles/39040/Auto-and-Manual-Reset-Events-Revisited
http://social.msdn.microsoft.com/Forums/vstudio/en-US/1e86a2cc-34d0-48a4-8381-8ed6e99a045b/when-and-why-would-one-use-the-autoresetevent-over-manualresetevent
Happy Coding.
krrishbiju-15589, if this helps please login to Mark As Answer. | Alert Moderator