Probably a silly question about Delay...

Ned Konz ned at bike-nomad.com
Thu Oct 26 16:35:07 UTC 2000


Kevin Fisher wrote:

> 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:

You can only have one process waiting on a given delay at a time.
Thus, if you're forking multiple processes for a single object, your
delay can't be an instance variable. Just make it a method local:

MyClass>>startNewProcess
| delay |
delay _ Delay forMilliseconds: 300.
[[
	delay wait.
	self doStuff
] repeat ] fork


-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list