How to do: something every: soOften?

Jimmie Houchin jhouchin at texoma.net
Sat Dec 27 00:17:28 UTC 2003


Ned Konz wrote:
> On Friday 26 December 2003 2:03 pm, Jimmie Houchin wrote:
> 
>>I am wanting to call a method every certainTimeInterval.
>>
>>The other day I spent the afternoon browsing for the appropriate method
>>to handle something like this. I found many different time, delay and
>>event type messages but I didn't spot anything like this:
>>
>>Cron do: [some activity] every: someTimeInterval
>>
>>I may very well have overlooked what I was looking for.
>>
>>I can definitely put something together that works from what I saw.
>>
>>But is there a favored way to handle something like this in Squeak.
> 
> If you're using Morphic, you can use stepping (you can step other messages 
> besides #step, and at different rates).
> 
> Look at the methods whose names contain the string 'startStepping'.
> 
> Otherwise, you can do (as Julian suggested):
> 
> [ delay := Delay forSeconds: 123456.
> 	[ delay wait. self doSomething ] repeat ] fork.

Hello Ned,

Thanks for the reply.

This is for a web app. So no Morphic.

I briefly browsed some of the stepping methods looking for ideas.
I don't remember if I had any. :)

I will use the Delay as suggested.

Thanks again.

Jimmie Houchin




More information about the Squeak-dev mailing list