Squeak Class Documentation category index | class index  
 
Delay
  category: Kernel-Processes
  superclass: Object
  subclasses: SUnitDelay

No comment. Sorry.

instance methods
  delaying
  isExpired
unschedule
wait

  private
  activate
adjustResumptionTimeOldBase:newBase:
resumptionTime
schedule
setDelay:forSemaphore:
signalWaitingProcess

class methods
  example
  testDelayOf:for:rect:

  instance creation
  forMilliseconds:
forSeconds:
howToUse
timeoutSemaphore:afterMSecs:

  primitives
  primSignal:atMilliseconds:

  snapshotting
  restoreResumptionTimes
saveResumptionTimes
shutDown
startUp

  testing
  anyActive

  timer process
  startTimerInterruptWatcher
timerInterruptWatcher

instance methods
  delaying top  
 

isExpired


 

unschedule

Unschedule this Delay. Do nothing if it wasn't scheduled.


 

wait

Schedule this Delay, then wait on its semaphore. The current process will be suspended for the amount of time specified when this Delay was created.


  private top  
 

activate

Private! Make the receiver the Delay to be awoken when the next timer interrupt occurs. This method should only be called from a block protected by the AccessProtect semaphore.


 

adjustResumptionTimeOldBase:newBase:

Private! Adjust the value of the system's millisecond clock at which this Delay will be awoken. Used to adjust resumption times after a snapshot or clock roll-over.


 

resumptionTime

Answer the value of the system's millisecondClock at which the receiver's suspended Process will resume.


 

schedule

Private! Schedule this Delay, but return immediately rather than waiting. The receiver's semaphore will be signalled when its delay duration has elapsed.


 

setDelay:forSemaphore:

Private! Initialize this delay to signal the given semaphore after the given number of milliseconds.


 

signalWaitingProcess

The delay time has elapsed; signal the waiting process.


class methods
  example top  
 

testDelayOf:for:rect:

Delay testDelayOf: 100 for: 20 rect: (10@10 extent: 30@30).
Delay testDelayOf: 400 for: 20 rect: (50@10 extent: 30@30).


  instance creation top  
 

forMilliseconds:

Return a new Delay for the given number of milliseconds. Sending 'wait' to this Delay will cause the sender's process to be suspended for approximately that length of time.


 

forSeconds:

Return a new Delay for the given number of seconds. Sending 'wait' to this Delay will cause the sender's process to be suspended for approximately that length of time.


 

howToUse

An instance of Delay responds to the message 'wait' by suspending the caller's process for a certain amount of time. The duration of the pause is specified when the Delay is created with the message forMilliseconds: or forSeconds:. A Delay can be used again when the current wait has finished. For example, a clock process might repeatedly wait on a one-second Delay.
The maximum delay is (SmallInteger maxVal // 2) milliseconds, or about six days. A delay in progress when an image snapshot is saved is resumed when the snapshot is re-started. Delays work across millisecond clock roll-overs.


 

timeoutSemaphore:afterMSecs:

Create and schedule a Delay to signal the given semaphore when the given number of milliseconds has elapsed. Return the scheduled Delay. The timeout can be cancelled by sending 'unschedule' to this Delay.


  primitives top  
 

primSignal:atMilliseconds:

Signal the semaphore when the millisecond clock reaches the value of the second argument. Fail if the first argument is neither a Semaphore nor nil. Essential. See Object documentation whatIsAPrimitive.


  snapshotting top  
 

restoreResumptionTimes

Private! Restore the resumption times of all scheduled Delays after a snapshot or clock roll-over. This method should be called only while the AccessProtect semaphore is held.


 

saveResumptionTimes

Private! Record the resumption times of all Delays relative to a base time of zero. This is done prior to snapshotting or adjusting the resumption times after a clock roll-over. This method should be called only while the AccessProtect semaphore is held.


 

shutDown

Suspend the active delay, if any, before snapshotting. It will be reactived when the snapshot is resumed.


 

startUp

Restart active delay, if any, when resuming a snapshot.


  testing top  
 

anyActive

Return true if there is any delay currently active


  timer process top  
 

startTimerInterruptWatcher

Reset the class variables that keep track of active Delays and re-start the timer interrupt watcher process. Any currently scheduled delays are forgotten.


 

timerInterruptWatcher

This loop runs in its own process. It waits for a timer interrupt and wakes up the active delay. Note that timer interrupts are only enabled when there are active delays.