Delay.st
changeset 20197 091727fab41e
parent 18996 d27c313ccf06
child 20206 51652e7f46dd
child 21503 d8d05099c9e5
equal deleted inserted replaced
20196:f2ce74d623d1 20197:091727fab41e
    36 "
    36 "
    37 !
    37 !
    38 
    38 
    39 documentation
    39 documentation
    40 "
    40 "
    41     Instances of Delay are used to suspend the execution of a process 
    41     Instances of Delay are used to suspend the execution of a process
    42     (i.e. thread) for some time interval. 
    42     (i.e. thread) for some time interval.
    43     Delays can be created either for some time-interval (seconds or milliseconds), 
    43     Delays can be created either for some time-interval (seconds or milliseconds),
    44     or for delaying until a specific time has reached.
    44     or for delaying until a specific time has reached.
    45     Once created, a delay is waited upon with Delay>>wait.
    45     Once created, a delay is waited upon with Delay>>wait.
    46 
    46 
    47     Notice: due to delays (both within Unix AND within Smalltalk itself,
    47     Notice: due to delays (both within Unix AND within Smalltalk itself,
    48     the resumption time will ALWAYS be after the actual delay time.
    48     the resumption time will ALWAYS be after the actual delay time.
    49     (i.e. a Delay for n-millis will actually suspend for more than n milliseconds)
    49     (i.e. a Delay for n-millis will actually suspend for more than n milliseconds)
    50 
    50 
    51     Warning: 
    51     Warning:
    52         currently, the implementation does not support delays longer than
    52         currently, the implementation does not support delays longer than
    53         a system specific maximum - future versions may remove this limitation.
    53         a system specific maximum - future versions may remove this limitation.
    54         For now, do not use delays longer than the value returned by
    54         For now, do not use delays longer than the value returned by
    55         OperatingSystem maximumMillisecondTimeDelta
    55         OperatingSystem maximumMillisecondTimeDelta
    56 
    56 
    66     [author:]
    66     [author:]
    67         Claus Gittinger
    67         Claus Gittinger
    68 "
    68 "
    69 !
    69 !
    70 
    70 
    71 examples 
    71 examples
    72 "
    72 "
    73     Check your systems resolution with:
    73     Check your systems resolution with:
    74     (make certain, that no other timed processes are running in the background when doing this)
    74     (make certain, that no other timed processes are running in the background when doing this)
    75                                                                         [exBegin]
    75                                                                         [exBegin]
    76         |d t1 t2 res|
    76         |d t1 t2 res|
   149 ! !
   149 ! !
   150 
   150 
   151 !Delay class methodsFor:'instance creation'!
   151 !Delay class methodsFor:'instance creation'!
   152 
   152 
   153 for:aTimeDuration
   153 for:aTimeDuration
   154     "return a new Delay object for delaying aNumber seconds"
   154     "return a new Delay object for delaying aTimeDuration"
   155 
   155 
   156     ^ self new delay:aTimeDuration getMilliseconds.
   156     ^ self new delay:aTimeDuration getMilliseconds
   157 
   157 
   158     "
   158     "
   159       Delay for:10 seconds
   159       Delay for:10 seconds
   160     "
   160     "
   161 !
   161 !