avoid returning from critical-blocks (avoid mkrealcontext calls)
authorClaus Gittinger <cg@exept.de>
Thu, 27 Mar 1997 16:20:51 +0100
changeset 1492 cb0118ee73e3
parent 1491 1f526a662592
child 1493 b162273f59f9
avoid returning from critical-blocks (avoid mkrealcontext calls)
WSensor.st
WindowSensor.st
--- a/WSensor.st	Thu Mar 27 15:52:55 1997 +0100
+++ b/WSensor.st	Thu Mar 27 16:20:51 1997 +0100
@@ -1248,21 +1248,22 @@
      Returns true, if a new event has been added to the queue, false if it
      was optimized away."
 
-    |wakeup|
+    |ret|
 
+    ret := false.
     accessLock critical:[
         (self basicAddDamage:aRectangle view:aView)
         ifTrue:[
             doWakeup ifTrue:[
                 self notifyEventArrival:aView.
-                ^ true
+                ret := true
             ].
         ].
     ].
-    ^ false
+    ^ ret
 
     "Created: 28.5.1996 / 21:51:16 / cg"
-    "Modified: 8.2.1997 / 12:10:35 / cg"
+    "Modified: 27.3.1997 / 16:11:56 / cg"
 !
 
 basicAddDamage:aRectangle view:aView
@@ -1449,44 +1450,54 @@
     "retrieve the next damage (either expose or resize event)
      or nil, if there is none. Remove it from the queue."
 
-    |d|
+    |d foundOne|
 
     damage size == 0 ifTrue:[^ nil].
 
-    [d isNil] whileTrue:[
-	"
-	 be careful: events are inserted at higher prio ...
-	"
-	accessLock critical:[
-	    damage size == 0 ifTrue:[^ nil].
-	    d := damage removeFirst.
-	]
+    foundOne := false.
+    [foundOne] whileFalse:[
+        "
+         be careful: events are inserted at higher prio ...
+        "
+        accessLock critical:[
+            damage size == 0 ifTrue:[
+                foundOne := true
+            ] ifFalse:[
+                d := damage removeFirst.
+                foundOne := d notNil.
+            ]
+        ]
     ].
     ^ d
 
-    "Modified: 18.1.1997 / 14:13:50 / cg"
+    "Modified: 27.3.1997 / 16:17:01 / cg"
 !
 
 nextEvent
     "retrieve the next event or nil, if there is none.
      Remove it from the queue."
 
-    |e|
+    |e foundOne|
 
     mouseAndKeyboard size == 0 ifTrue:[^ nil].
 
-    [e isNil] whileTrue:[
-	"
-	 be careful: events are inserted at higher prio ...
-	"
-	accessLock critical:[
-	    mouseAndKeyboard size == 0 ifTrue:[^ nil].
-	    e := mouseAndKeyboard removeFirst.
-	]
+    foundOne := false.
+    [foundOne] whileFalse:[
+        "
+         be careful: events are inserted at higher prio ...
+        "
+        accessLock critical:[
+            mouseAndKeyboard size == 0 ifTrue:[
+                foundOne := true
+            ] ifFalse:[
+                e := mouseAndKeyboard removeFirst.
+                foundOne := e notNil.
+            ]
+        ]
     ].
     ^ e
 
-    "Modified: 18.1.1997 / 14:13:39 / cg"
+    "Modified: 27.3.1997 / 16:17:38 / cg"
 !
 
 nextExposeEventFor:aView
@@ -2227,6 +2238,6 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.91 1997-03-03 19:22:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.92 1997-03-27 15:20:51 cg Exp $'
 ! !
 WindowSensor initialize!
--- a/WindowSensor.st	Thu Mar 27 15:52:55 1997 +0100
+++ b/WindowSensor.st	Thu Mar 27 16:20:51 1997 +0100
@@ -1248,21 +1248,22 @@
      Returns true, if a new event has been added to the queue, false if it
      was optimized away."
 
-    |wakeup|
+    |ret|
 
+    ret := false.
     accessLock critical:[
         (self basicAddDamage:aRectangle view:aView)
         ifTrue:[
             doWakeup ifTrue:[
                 self notifyEventArrival:aView.
-                ^ true
+                ret := true
             ].
         ].
     ].
-    ^ false
+    ^ ret
 
     "Created: 28.5.1996 / 21:51:16 / cg"
-    "Modified: 8.2.1997 / 12:10:35 / cg"
+    "Modified: 27.3.1997 / 16:11:56 / cg"
 !
 
 basicAddDamage:aRectangle view:aView
@@ -1449,44 +1450,54 @@
     "retrieve the next damage (either expose or resize event)
      or nil, if there is none. Remove it from the queue."
 
-    |d|
+    |d foundOne|
 
     damage size == 0 ifTrue:[^ nil].
 
-    [d isNil] whileTrue:[
-	"
-	 be careful: events are inserted at higher prio ...
-	"
-	accessLock critical:[
-	    damage size == 0 ifTrue:[^ nil].
-	    d := damage removeFirst.
-	]
+    foundOne := false.
+    [foundOne] whileFalse:[
+        "
+         be careful: events are inserted at higher prio ...
+        "
+        accessLock critical:[
+            damage size == 0 ifTrue:[
+                foundOne := true
+            ] ifFalse:[
+                d := damage removeFirst.
+                foundOne := d notNil.
+            ]
+        ]
     ].
     ^ d
 
-    "Modified: 18.1.1997 / 14:13:50 / cg"
+    "Modified: 27.3.1997 / 16:17:01 / cg"
 !
 
 nextEvent
     "retrieve the next event or nil, if there is none.
      Remove it from the queue."
 
-    |e|
+    |e foundOne|
 
     mouseAndKeyboard size == 0 ifTrue:[^ nil].
 
-    [e isNil] whileTrue:[
-	"
-	 be careful: events are inserted at higher prio ...
-	"
-	accessLock critical:[
-	    mouseAndKeyboard size == 0 ifTrue:[^ nil].
-	    e := mouseAndKeyboard removeFirst.
-	]
+    foundOne := false.
+    [foundOne] whileFalse:[
+        "
+         be careful: events are inserted at higher prio ...
+        "
+        accessLock critical:[
+            mouseAndKeyboard size == 0 ifTrue:[
+                foundOne := true
+            ] ifFalse:[
+                e := mouseAndKeyboard removeFirst.
+                foundOne := e notNil.
+            ]
+        ]
     ].
     ^ e
 
-    "Modified: 18.1.1997 / 14:13:39 / cg"
+    "Modified: 27.3.1997 / 16:17:38 / cg"
 !
 
 nextExposeEventFor:aView
@@ -2227,6 +2238,6 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.91 1997-03-03 19:22:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.92 1997-03-27 15:20:51 cg Exp $'
 ! !
 WindowSensor initialize!