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

后端 未结 11 2223
慢半拍i
慢半拍i 2020-11-27 09:06

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 do

11条回答
  •  悲&欢浪女
    2020-11-27 09:32

    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.

提交回复
热议问题