2

https://learn.microsoft.com/en-us/dotnet/api/system.threading.manualresetevent?view=net-6.0

I am having a hard time understanding the difference between Reset() and WaitOne().

What is the difference in these two if they are both blocking the thread.

John
  • 47
  • 2
  • 1
    Does this answer your question? [What is the difference between ManualResetEvent and AutoResetEvent in .NET?](https://stackoverflow.com/questions/153877/what-is-the-difference-between-manualresetevent-and-autoresetevent-in-net) – Eldar Feb 14 '22 at 18:19
  • 2
    `.Reset()` does not block at all -- it causes threads that are waiting on the event to block, not the calling thread. – Jeroen Mostert Feb 14 '22 at 18:19

1 Answers1

1

Set() and Reset() are used when you want to control other threads . WaitOne() is used by the threads that shall be synchronized.

BTW, you got the sentence wrong:

Reset()

Sets the state of the event to nonsignaled, causing threads to block.

It says "causing threads" = other threads, not the thread that is calling the method.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222