tags:

views:

329

answers:

2

Does WaitForSingleObject() with timeout = 0 ms result in thread context switch immediately and the thread to loose its remaining timeslice?

A: 

If the handle is signaled it does not enter a waite state ever. And if the dwMilliseconds parameter is 0 it will not enter the wait state even if it is not signaled.

Regarding its second param: dwMilliseconds MSDN says the following:

... if dwMilliseconds is zero, the function does not enter a wait state if the object is not signaled; it always returns immediately...

Brian R. Bondy
+2  A: 

The documentation says otherwise. MSDN: WatiForSingleObject:

If dwMilliseconds is zero, the function does not enter a wait state if the object is not signaled; it always returns immediately.

Timbo