Search code examples
c#resetautoresetevent

AutoResetEvent Reset method


Could someone introduce an use case for AutoResetEvent.Reset() method ? When and why I would like to use this method ? I understand WaitOne and Set but this is quite unclear for me.


Solution

  • Yes the AutoResetEvent will automatically reset it's state whenever a thread which is waiting on the event is signaled. However it's possible that a given event is no longer valid and no thread has waited on an AutoResetEvent since it was originally set. In that scenario the Reset method becomes useful