What is the difference between ManualResetEvent and AutoResetEvent in .NET?
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?
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.
Or like a door and a turnstile. 旋转栅门(常设于公共建筑、体育场等入口处); 也类似于地铁站刷卡过的那个栏杆