How to schedule a task
Cédrick Béler
cbeler at enit.fr
Thu Mar 16 11:44:15 UTC 2006
Hi and thanks for answering :)
> However, those scripting extensions do not work in plain Squeak, but
> only in Tweak or Croquet.
Thats maybe why I don't have waitTick: :)
> Also, for a 3 hour delay you might want to use a Delay ("self wait:
> 3*60*60") instead of checking in every tick.
Ok for that. When a process is waiting is it consuming ressources ? is
it reliable ?
If I have well understood, your advice is to use an endless loop instead
of an instance of Scheduler ?
>> I haven't the whole solution but Bert gave me an advise for such
>> things. Define a method within your class with the task you need
>> with an endless loop. In this loop you wait for the next tick (self
>> waitTick). In this loop you define the loading of the XML file.
>> Start this method as a script e.g. in the step of initializing.
>>
>> self startScript: #loadXML
>
I found a method Player>>startScript: is it the one you're talking about ?
To do in plain squeak, I was thinking doing something like:
Manager class >> initialize
Smalltalk addToStartUpList: self
Manager class >> startUp
self scheduler ifNil: [ self scheduler: TaskScheduler new.
self scheduler
do: [self getXML]
every: 3 hours ].
self scheduler start.
Manager class >> shutDown " not sure I have too "
self scheduler stop
I didnt test it yet
do you think an endless loop (+ wait) is "better" than aScheduler ?
they both seem to use Semaphore (which I dont really understand for
now... need to get into :) )
I have another question concerning #shutDown
Is it called even when the image crashes ?
Thank you
Cédrick
--------------------------------
L'ENIT vous invite a sa journee portes ouvertes le 17 mars 2006 de 13h30 a 19h30
Enit , 47 avenue d'Azereix 65000 Tarbes
Bus N°1, arret ENI
More information about the Squeak-dev
mailing list
|