12

In C# what is the difference between manual reset event, autoresetevent. Also when should one use the same. What is difference between setting autoresetevent to true or false.

Prashant
  • 2,190
  • 4
  • 33
  • 64
  • possible duplicate of [What is the difference between ManualResetEvent and AutoResetEvent in .net?](http://stackoverflow.com/questions/153877/what-is-the-difference-between-manualresetevent-and-autoresetevent-in-net) – dance2die Jun 08 '11 at 01:41
  • 1
    Here is an awesome explanation with pictures :) http://multithreads.blogspot.de/2007/09/eventwaithandler-autoresetevent-and.html – VladL Dec 12 '13 at 16:07

1 Answers1

16

For the ManualResetEvent, once you've called Set(), you have to deliberately call Reset() to put it back in an unsignaled state such that calls to WaitOne() will block.

This is not necessary for AutoResetEvent.

The documentation is pretty good on MSDN for ManualResetEvent and AutoResetEvent.

Neil Barnwell
  • 41,080
  • 29
  • 148
  • 220
  • Also note that AutoResetEvent.Set() release only one waiting thread, while ManualResetEvent.Set() release all waiting threads and do not block anymore (until you call Reset). – Olivier de Rivoyre Nov 14 '17 at 13:13