Re: How do I Sleep for a specified amount of time and relinquish c

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"nickdu" <nicknospamdu@xxxxxxxxxxxxxxxx> wrote in message
news:2D22EF5C-0EA0-4E24-8523-305922CB286D@xxxxxxxxxxxxxxxx
From reading the docs I'm remember it saying something about continuing to
use the thread's quanta.

From reading which docs? It just makes no sense that any version of Sleep()
would in fact do a spin wait until the timeslice is up. The moment you call
Sleep() (.NET or Windows API) with a non-zero value, that thread should be
suspended (and most of the time even with zero passed to it). I have a hard
time believing you've seen any official documentation that says otherwise.

The fact that using the wait-on-an-event method instead changes the behavior
doesn't prove that Sleep() was using up the timeslice. It just means it
does something different that changed the behavior.

Pete


.



Relevant Pages

  • Sleep(DWORD) returns in _less_ time than specified
    ... Win32 Sleep is documented to return in no less than the time specified. ... bug in either the implementation or documentation. ... (sleepTime / TIMESLICE) ...
    (microsoft.public.win32.programmer.kernel)
  • Re: wait for process terminate
    ... It won't quite work like this - sleep will return to give it the ... remainer of it's "timeslice", and the scheduler will be reinvoked at ... The reason it is very likely to be this way is that the scheduler will ... be invoked on a timer interrupt. ...
    (comp.lang.pascal.delphi.misc)
  • Re: wait for process terminate
    ... the time slice should be yielded. ... The only time Sleep does not release its timeslice is when its argument ... is 0 and there are no other qualifying threads waiting to be scheduled. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Sleep(DWORD) returns in _less_ time than specified
    ... On one system, calling GetSystemTimeAdjustment returns: ... 156250 for TimeAdjustment ... since I would effectively be jumping over a time-slice every timeslice. ... However, by this logic, a Sleep for 5 sec. ) should return after ...
    (microsoft.public.win32.programmer.kernel)