C# ManualResetEvent Reset vs WaitOne

630 Views Asked by At

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.

1

There are 1 best solutions below

0
Thomas Weller On

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.