Re: time delay



Another serious problem here is that in general, you cannot reliably compare
tick count with the expected value. Counters can overflow.

One should compare difference between starting tick count and current tick
count, with a desired value.

In Linux sources, there is a bad habit of comparing 'jiffies' against the
target time. Unfortunately, this may break at around 470th day of uptime.


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:1giu91tg6qjb26uhg12uara5fstulrdfl1@xxxxxxxxxx
> Pick any value for your delay. I can guarantee that it will be wrong. This
> is exactly the
> WRONG way to wait for an application to enter its message loop. Look at
>
> WaitForInputIdle
>
> which is the correct way to wait for a child process to come up. Note that
> like all wait
> operations, this blocks the waiting thread, so if the thread is a main GUI
> thread, you
> should not do a wait there; instead, you should spawn another thread which
> does the
> WaitForInputIdle and posts a message back to the main GUI thread when the
> created process
> is ready to accept input.
>
> Generally, if you are in a situation where polling is required, you should
> always rethink
> the problem to see if polling can be avoided.
>
> For some details on how to use a separate thread to handle blocking
> requests and provide
> asynchronous notification, see my essay on asynchronous process
> notification on my MVP
> Tips site.
> joe
>


.



Relevant Pages

  • Re: Karl, I need to understand your Timer!
    ... An MMTimer is probably the best idea, as it runs in it's own thread, ... successfully "played" a sequence of MIDI events that kept on playing ... Messick's Maximum MIDI, the tick generator ... compare it with the delta time of the next MIDI event pending in the ...
    (microsoft.public.vb.general.discussion)
  • Re: time delay
    ... I think the ms timer overflows about every 48 days, ... >Another serious problem here is that in general, you cannot reliably compare ... >tick count with the expected value. ... >> notification on my MVP ...
    (microsoft.public.vc.mfc)
  • Re: What am I missing here?
    ... but according to their "compare" list, ... physical dimensions - electronically they appear to be the same. ... I can't give you a direct link because it won't allow it but, ... and tick the two models it shows differences - mainly in the sound system but also the 85 variant has a top-up-tv card slot. ...
    (uk.tech.digital-tv)
  • Re: DispatchMessage: What is message # 0xC0FE ?
    ... compare two of those values, ... Tick count absolute value is NOT safe to compare. ...
    (microsoft.public.vc.mfc)
  • Re: device polling takes more CPU hits??
    ... On Tuesday 27 July 2004 16:39, Luigi Rizzo wrote: ... I'm just trying to dig into how the current polling implementation is supposed ... Doesn't the polling code do three calls to microuptime() per each tick - the ...
    (freebsd-net)