Probably a silly question about Delay...

Kevin Fisher kgf at golden.net
Thu Oct 26 10:40:58 UTC 2000


Thanks to a recent thread about Delay I've rewritten a portion of my code to 
reuse Delay, instead of just running (Delay forMilliseconds: 300) wait every 
iteration.

However, now that I've done this it doesn't work!

Essentially I've got a newProcess that loops in the background, delaying 300 
milliseconds before it loops again.  I've got an instance variable called 
'delay' which gets initialized thusly:

delay _ Delay forMilliseconds: 300.

Later in my loop I do a:

	delay wait.

However, when this happens I get a big red debug dialog telling me that the 
delay was already scheduled.  In fact, if I have the following lines together 
I get the same error:

delay _ Delay forMilliseconds:300.
delay wait.

But, if I do this, it works fine:
(Delay forMilliseconds: 300) delay.  

I'm assuming this works because the Delay that gets created gets GC'd.

Any ideas?  The whole idea was to reuse the existing delay.  Do I need to 
unschedule the delay before I use it again?






More information about the Squeak-dev mailing list