[Newbies] Re: Wait for an external app

Andreas Raab andreas.raab at gmx.de
Mon Nov 8 19:31:28 UTC 2010


On 11/8/2010 8:12 AM, 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?

FWIW, if your application is interactive, I would do that test in a step 
method rather than a background process. I.e.,

MyMorph>>startPlaying
	"Start playing and establish the time watcher"

	cd play.
	self startStepping: #watchPlayTime  at: Time millisecondClockValue 
arguments: nil stepTime: 20.

MyMorph>>watchPlayTime
	"is it time to stop playing?"

	cd position > endTime ifTrue:[self stopPlaying].

MyMorph>>stopPlaying
	"Stop playing. Also stop the watcher."

	cd pause.
	self stopStepping: #watchPlayTime.

Cheers,
   - Andreas


More information about the Beginners mailing list