#TUNING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 02 Aug 2017 14:19:53 +0200
changeset 22154 57770b556bdd
parent 22153 b12f00ae6f4b
child 22155 9ba2e6b6034c
#TUNING by stefan class: Delay changed: #wait use SmallInteger maxVal // 4 for maximum millisecond delta
Delay.st
--- a/Delay.st	Wed Aug 02 13:15:54 2017 +0200
+++ b/Delay.st	Wed Aug 02 14:19:53 2017 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -327,21 +329,22 @@
      has passed (if millisecondDelta is non-nil), or the absolute millisecondTime
      has been reached (if resumptionTime non-nil)."
 
-    |wasBlocked currentDelta dueTime then|
+    |wasBlocked currentDelta dueTime then maxMilliseconds|
 
     isInterrupted := false.
 
     millisecondDelta notNil ifTrue:[
+        maxMilliseconds := SmallInteger maxVal // 4.
         currentDelta := millisecondDelta rounded.
         currentDelta <= 0 ifTrue:[
             ^ self.
         ].
-        currentDelta > 16r0fffffff ifTrue:[
+        currentDelta > maxMilliseconds ifTrue:[
             "NOTE: the microsecondTime is increasing monotonically,
                    while millisecondTime is wrapping at 16r1fffffff.
                    So use the microsecondTime to check when we are finished"
             dueTime := OperatingSystem getMicrosecondTime + (currentDelta * 1000).
-            currentDelta := 16r0fffffff.
+            currentDelta := maxMilliseconds.
         ].
         then := OperatingSystem 
                     millisecondTimeAdd:OperatingSystem getMillisecondTime 
@@ -362,7 +365,7 @@
               and:[isInterrupted not
               and:[(currentDelta := dueTime - OperatingSystem getMicrosecondTime) > 0
               and:[
-                currentDelta := (currentDelta // 1000) min:16r0fffffff.
+                currentDelta := (currentDelta // 1000) min:maxMilliseconds.
                 then := OperatingSystem millisecondTimeAdd:OperatingSystem getMillisecondTime and:currentDelta.
                 true.]]]
         ] whileTrue.
@@ -377,7 +380,7 @@
     "
 
     "Modified: / 26-02-1997 / 15:21:35 / cg"
-    "Modified (format): / 21-02-2017 / 15:13:57 / stefan"
+    "Modified: / 02-08-2017 / 14:17:54 / stefan"
 ! !
 
 !Delay methodsFor:'early signalling'!