How to do: something every: soOften?

Jimmie Houchin jhouchin at texoma.net
Fri Dec 26 23:55:34 UTC 2003


Julian Fitzell wrote:
> You could do:
> 
> [[(Delay forSeconds: 60) wait. some activity] repeat] fork
> 
> though I agree it would be nice to have a better mechanism for this.
> 
> Julian
> 
[snip]

Hello Julian,

Thanks for the reply.

Well until something better appears or I write something better.
Does something like this look alright.

[self continue] whileTrue: [doSomething.
	(Delay forSeconds: 60) wait].

I did this in a workspace/transcript for testing. Did fine, don't know 
how efficient it is but it did work.

|continue|
continue := true.
ptime _ 0
ctime _ 0
secsDelay _ 0
[continue] whileTrue: [
	ptime _ ctime.
	ctime _ Time millisecondClockValue.
	secsDelay _ ctime - ptime.
	Transcript show: ctime asString, ':  ', secsDelay asString ;cr.
	(Delay forMilliseconds: 2000) wait].

Thanks again.

Jimmie Houchin




More information about the Squeak-dev mailing list