ProcessorScheduler.st
changeset 6421 58dca33cf0fc
parent 6376 6a3ce5694cc9
child 6434 f23d12900e18
--- a/ProcessorScheduler.st	Tue Feb 26 12:40:42 2002 +0100
+++ b/ProcessorScheduler.st	Tue Feb 26 14:02:26 2002 +0100
@@ -1059,37 +1059,37 @@
     "/ no interrupt processing, to avoid races with monitorPid
     wasBlocked := OperatingSystem blockInterrupts.
     [
-	[
-	    osProcessStatus := OperatingSystem childProcessWait:blocking pid:nil.
-	    osProcessStatus notNil ifTrue:[
-		|pid action|
-
-		pid := osProcessStatus pid.
-		osProcessStatus stillAlive ifTrue:[
-		    action := osChildExitActions at:pid ifAbsent:nil.
-		] ifFalse:[
-		    action := osChildExitActions removeKey:pid ifAbsent:nil.
-		].
-		action notNil ifTrue:[
-		    action value:osProcessStatus
-		].
-	    ].
-
-	    "/ if pollChildProcesses does block, poll only one status change.
-	    "/ we will get another SIGCHLD for other status changes.
-
-	    osProcessStatus notNil and:[blocking not]
-	] whileTrue.
-
-	"/ if there are no more waiters, disable SIGCHILD handler.
-	"/ this helps us with synchronous waiters (e.g. pclose),
-	"/ But they should block SIGCHLD anyway.
-
-	osChildExitActions isEmpty ifTrue:[
-	    OperatingSystem disableChildSignalInterrupts.
-	].
-    ] valueNowOrOnUnwindDo:[
-	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+        [
+            osProcessStatus := OperatingSystem childProcessWait:blocking pid:nil.
+            osProcessStatus notNil ifTrue:[
+                |pid action|
+
+                pid := osProcessStatus pid.
+                osProcessStatus stillAlive ifTrue:[
+                    action := osChildExitActions at:pid ifAbsent:nil.
+                ] ifFalse:[
+                    action := osChildExitActions removeKey:pid ifAbsent:nil.
+                ].
+                action notNil ifTrue:[
+                    action value:osProcessStatus
+                ].
+            ].
+
+            "/ if pollChildProcesses does block, poll only one status change.
+            "/ we will get another SIGCHLD for other status changes.
+
+            osProcessStatus notNil and:[blocking not]
+        ] whileTrue.
+
+        "/ if there are no more waiters, disable SIGCHILD handler.
+        "/ this helps us with synchronous waiters (e.g. pclose),
+        "/ But they should block SIGCHLD anyway.
+
+        osChildExitActions isEmpty ifTrue:[
+            OperatingSystem disableChildSignalInterrupts.
+        ].
+    ] ensure:[
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ]
 
     "Modified: 5.1.1996 / 16:56:11 / stefan"
@@ -1636,44 +1636,44 @@
     "
     newPrio := prio.
     newPrio < 1 ifTrue:[
-	newPrio := 1.
+        newPrio := 1.
     ] ifFalse:[
-	newPrio > HighestPriority ifTrue:[
-	    newPrio := HighestPriority
-	]
+        newPrio > HighestPriority ifTrue:[
+            newPrio := HighestPriority
+        ]
     ].
 
     [
-	wasBlocked := OperatingSystem blockInterrupts.
-
-	aProcess setPriority:newPrio.
-
-	oldList := quiescentProcessLists at:oldPrio.
-	oldList notNil ifTrue:[
-	    (oldList remove:aProcess ifAbsent:nil) notNil ifTrue:[
-		newList := quiescentProcessLists at:newPrio.
-		newList isNil ifTrue:[
-		    quiescentProcessLists at:newPrio put:(newList := LinkedList new).
-		].
-		newList addLast:aProcess.
-
-		"if its the current process lowering its prio 
-		 or another one raising, we have to reschedule"
-
-		aProcess == activeProcess ifTrue:[
-		    currentPriority := newPrio.
-		    newPrio < oldPrio ifTrue:[
-			self threadSwitch:scheduler.    
-		    ]
-		] ifFalse:[
-		    newPrio > currentPriority ifTrue:[
-			self threadSwitch:aProcess.
-		    ]
-		].
-	    ]
-	]
-    ] valueNowOrOnUnwindDo:[
-	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+        wasBlocked := OperatingSystem blockInterrupts.
+
+        aProcess setPriority:newPrio.
+
+        oldList := quiescentProcessLists at:oldPrio.
+        oldList notNil ifTrue:[
+            (oldList remove:aProcess ifAbsent:nil) notNil ifTrue:[
+                newList := quiescentProcessLists at:newPrio.
+                newList isNil ifTrue:[
+                    quiescentProcessLists at:newPrio put:(newList := LinkedList new).
+                ].
+                newList addLast:aProcess.
+
+                "if its the current process lowering its prio 
+                 or another one raising, we have to reschedule"
+
+                aProcess == activeProcess ifTrue:[
+                    currentPriority := newPrio.
+                    newPrio < oldPrio ifTrue:[
+                        self threadSwitch:scheduler.    
+                    ]
+                ] ifFalse:[
+                    newPrio > currentPriority ifTrue:[
+                        self threadSwitch:aProcess.
+                    ]
+                ].
+            ]
+        ]
+    ] ensure:[
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ]
 
     "Modified: / 4.8.1998 / 00:08:54 / cg"
@@ -3141,6 +3141,6 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.196 2002-02-04 14:31:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.197 2002-02-26 13:00:58 cg Exp $'
 ! !
 ProcessorScheduler initialize!