How to schedule a task
David Shaffer
cdshaffer at acm.org
Thu Mar 16 16:27:04 UTC 2006
Seems like you've gotten a fair number of tips but I'd like to add
one...have a look at the KomServices framework. Subclassing
ApplicationService is pretty straightfoward and gives you a fair amount
of framework support: starting/stopping process on image
startup/shutdown, graceful shutdown (rather than terminating the block),
services registered by name etc. The class comments will probably tell
you what you need to know but, as an example:
runWhile: aBlock
[aBlock value]
whileTrue: [self doSomethingImportant.
self sleepFor: 30000.]
in a subclass of ApplicationService will execute doSomethingImport every
30 seconds. You would start it with:
"Start the service"
(MyServiceClass newNamed: 'important service') start
"Stop it"
(MyServiceClass serviceNamed: 'important service') stop.
etc
David
More information about the Squeak-dev
mailing list
|