What is the difference between ManualResetEvent and AutoResetEvent in .NET?


Question

I have read the documentation on this and I think I understand. An AutoResetEvent resets when the code passes through event.WaitOne(), but a ManualResetEvent does not.

Is this correct?

1
502
11/8/2011 9:08:50 AM

Accepted Answer

Yes. It's like the difference between a tollbooth and a door. The ManualResetEvent is the door, which needs to be closed (reset) manually. The AutoResetEvent is a tollbooth, allowing one car to go by and automatically closing before the next one can get through.

874
1/7/2015 10:39:25 AM

Just imagine that the AutoResetEvent executes WaitOne() and Reset() as a single atomic operation.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon