ProcessorScheduler.st
changeset 1042 cc49fd1e3c7e
parent 1032 924c177085f8
child 1061 61012b7bed9c
--- a/ProcessorScheduler.st	Thu Feb 29 03:23:23 1996 +0100
+++ b/ProcessorScheduler.st	Thu Feb 29 03:24:06 1996 +0100
@@ -1129,6 +1129,7 @@
 
     oldPrio := aProcess priority.
     oldPrio == prio ifTrue:[^ self].
+    aProcess == scheduler ifTrue:[^ self].
 
     "
      check for valid argument
@@ -1137,38 +1138,40 @@
     newPrio < 1 ifTrue:[
         newPrio := 1.
     ] ifFalse:[
-        aProcess == scheduler ifTrue:[^ self].
         newPrio > HighestPriority ifTrue:[
             newPrio := HighestPriority
         ]
     ].
 
-    wasBlocked := OperatingSystem blockInterrupts.
+    [
+	wasBlocked := OperatingSystem blockInterrupts.
 
-    aProcess setPriority:newPrio.
+        aProcess setPriority:newPrio.
 
-    oldList := quiescentProcessLists at:oldPrio.
-    (oldList identityIndexOf:aProcess) ~~ 0 ifTrue:[
-        oldList remove:aProcess.
+        oldList := quiescentProcessLists at:oldPrio.
+        (oldList identityIndexOf:aProcess) ~~ 0 ifTrue:[
+            oldList remove:aProcess.
 
-        newList := quiescentProcessLists at:newPrio.
-        newList addLast:aProcess.
+            newList := quiescentProcessLists at:newPrio.
+            newList addLast:aProcess.
+
+            "if its the current process lowering its prio 
+             or another one raising, we have to reschedule"
 
-        "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.
-            ]
+            aProcess == activeProcess ifTrue:[
+                currentPriority := newPrio.
+                newPrio < oldPrio ifTrue:[
+                    self threadSwitch:scheduler.    
+                ]
+            ] ifFalse:[
+                newPrio > currentPriority ifTrue:[
+                    self threadSwitch:aProcess.
+                ]
+            ].
         ].
-    ].
-    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+    ] valueNowOrOnUnwindDo:[
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+    ]
 
     "Modified: 28.2.1996 / 21:20:47 / cg"
 !
@@ -1924,6 +1927,6 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.69 1996-02-28 20:36:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.70 1996-02-29 02:24:06 cg Exp $'
 ! !
 ProcessorScheduler initialize!