lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Wakeful sleep


From: Greg Chicares
Subject: [lmi] Wakeful sleep
Date: Fri, 08 Nov 2013 14:03:43 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

lmi sends illustrations to a printer in census order, but end users
have complained that they are printed in a different order. Pausing
for ten seconds between printouts seems to forestall that problem.
Ideally, this pause would have two properties:

(1) The GUI still updates normally. If the user toggles to another
application (e.g., with alt-Tab on msw), then toggling back to lmi
causes it to repaint promptly. Otherwise, end users will think it
has "died", and they'll see that as a defect. And lmi must continue
to accept a Cancel event to end the progress dialog that it displays
during a series of print operations (although it's not imperative for
Cancel to interrupt the pause to produce an instantaneous effect).

(2) Except for the minimal activity in (1), no resources are consumed.
Thus,
  while(elapsed_time < ten seconds) /* do nothing */ ;
would occupy a core that should be left available for other tasks...but
some end users still have machines with only one CPU core.

How should I do this with wx? In HEAD (revision 5821), I'm just calling
wxSleep(), which satisfies (2) but not (1). This alternative seems okay:

    for(int i = 0; i < 10 * seconds_to_pause; ++i)
        {
        wxMilliSleep(100);
        wxTheApp && wxTheApp->Yield(true);
        }

but is there a better way?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]