What is the difference between Thread.Sleep(timeout) and ManualResetEvent.Wait(timeout)?

Posted by Erik Forbes on Stack Overflow See other posts from Stack Overflow or by Erik Forbes
Published on 2010-06-08T16:06:45Z Indexed on 2010/06/08 16:12 UTC
Read the original article Hit count: 277

Filed under:
|
|
|
|

Both Thread.Sleep(timeout) and resetEvent.Wait(timeout) cause execution to pause for at least timeout milliseconds, so is there a difference between them? I know that Thread.Sleep causes the thread to give up the remainder of its time slice, thus possibly resulting in a sleep that lasts far longer than asked for. Does the Wait(timeout) method of a ManualResetEvent object have the same problem?

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading