No announcement yet.

time slice

  • Filter
  • Time
  • Show
Clear All
new posts

  • time slice

    Is there an API call to allow a PB/dll app to give up its time slice?

    If so, what is it and what are its parameters?

    Walt Decker

  • #2
    Walt --

    Use SLEEP 0 to give up the remainder of your app's current time slice.

    In my experience, however, SLEEP 0 usually has little effect. You'll probably have to use SLEEP 1, which theoretically gives up the remainder of the current time slice plus one millisecond.

    In reality, the resolution of the Windows SLEEP API is around 10 ms, so SLEEP 10 will have the same effect as SLEEP 1.

    And finally, keep in mind that Windows will continue giving up time slices until 10 ms have passed. So if Windows is busy doing other things and is only giving your app a time slice every 20 ms (for example), then SLEEP 10 will cause a longer delay. So SLEEP is not a good way to measure time.

    In the end, SLEEP gives up the remainder of your app's current time slice, plus at least the number of milliseconds that you specify (rounded to the next-highest multiple of 10).

    -- Eric

    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    [This message has been edited by Eric Pearson (edited December 02, 2000).]
    "Not my circus, not my monkeys."


    • #3
      Thank you, Eric. That helps loads.

      Walt Decker