[Newbies] Re: Wait for an external app

Bert Freudenberg bert at freudenbergs.de
Mon Nov 8 16:32:03 UTC 2010

On 08.11.2010, at 17:12, Sean P. DeNigris wrote:

> This will starve lower priority processes, because Processor yield only 
> activates same or higher priority processes. A short delay is better.
> Okay, will do.  Is there an idiomatic "short delay" (e.g. 50ms) or just make
> something up?

Use the largest you can that gives you the needed accuracy. Polling 20 times per second is not that much but might still be overkill.

If you can estimate the time remaining then you could even use an adaptive delay. E.g. wait 90% of the remaining time:

   cd play.
   [ [ (remaining := endTime - cd position) > 0 ] whileTrue: [ (Delay forSeconds: remaining * 0.9) wait ].
        cd pause ] fork.

That's assuming "position" is in seconds, of course.

- Bert -

More information about the Beginners mailing list