Possible duplicate: What is the difference ManualResetEvent and AutoResetEvent in .net?
What is the difference between ManualResetEvent and AutoResetEvent ? (Example could be helpful).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ManualResetEventis like a gate in a field – once it’s been opened, it lets people through until someone shuts it.AutoResetEventis like a turnstile in a train station – once you’ve put the ticket in, one person can go through, but only one.Here’s an example – 5 threads are all waiting for the same event, which is set once per second. With a manual reset event, all the threads “go through the gate” as soon as it’s been set once. With an auto-reset event, only one goes at a time.
Sample output for
ManualResetEvent:Sample output for
AutoResetEvent:(The program then just hangs, as there are two threads still waiting for the event to be set, and nothing is going to set it.)