Squeak 'cron'-like functionality?
Tim Rowledge
tim at sumeru.stanford.edu
Wed Oct 3 03:22:16 UTC 2001
What's wrong with adding a simple (ish) method in Delay:-
Delay>untilMilliseconds: anInteger
"Return a new Delay to wait until the time is the given value of
milliseconds. Sending 'wait' to this Delay will cause the sender's
process to be suspended until approximately that time."
| delayTicks |
delayTicks _ anInteger - Time millisecondClockValue.
delayTicks < 0 ifTrue: [self error: 'delay times cannot be negative'].
^ self new
setDelay: delayTicks
forSemaphore: Semaphore new
This would work within the same limits that the current delays work - ie
the delay is within 32bits of milliseconds. Delay>untilTime: and
untilDate: would also be possible but would require some trickery to
handle wraparound of the millisecond value etc.
tim
More information about the Squeak-dev
mailing list
|