preps for rel5 migration
authorClaus Gittinger <cg@exept.de>
Fri, 07 Jul 2000 16:13:34 +0200
changeset 5449 bf1de72fd2bb
parent 5448 52bc958599a7
child 5450 b0edfff99a73
preps for rel5 migration
ProcessorScheduler.st
--- a/ProcessorScheduler.st	Fri Jul 07 15:05:13 2000 +0200
+++ b/ProcessorScheduler.st	Fri Jul 07 16:13:34 2000 +0200
@@ -1241,22 +1241,11 @@
     aProcess state:#active.
     oldProcess setStateTo:#run if:#active.
 
-    "
-     no interrupts now - activeProcess has already been changed
-     (dont add any message sends here)
-    "
+    currentPriority := pri.
     activeProcess := aProcess.
     activeProcessId := id.
-    currentPriority := pri.
-%{
-    extern OBJ ___threadSwitch();
-
-    if (__isSmallInteger(id)) {
-	ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0);
-    } else {
-	ok = false;
-    }
-%}.
+    ok := self threadSwitch:aProcess id:id singleStep:singleStep.
+
     "time passes spent in some other process ...
      ... here again"
 
@@ -1266,42 +1255,65 @@
     currentPriority := oldProcess priority.
 
     ok == true ifFalse:[
-	"
-	 switch failed for some reason -
-	 destroy (hard-terminate) the bad process.
-	 This happens when:
-	 - the stack went above the absolute limit
-	   (VM switches back to scheduler)
-	 - a halted process cannot execute its interrupt
-	   actions (win32 only)
-	"
-	(id := p id) ~~ 0 ifTrue:[
-	    id notNil ifTrue:[
-		'Processor [warning]: problem with process ' errorPrint. 
-		id errorPrint. 
-		(nm := p name) notNil ifTrue:[
-		    ' (' errorPrint. nm errorPrint. ')' errorPrint.
-		].
-
-		ok == #halted ifTrue:[
-		    "/ that process was halted (win32 only)
-		    p state:#halted.
-		   '; stopped it.' errorPrintCR.
-		   self suspend:p.
-		] ifFalse:[
-		   '; hard-terminate it.' errorPrintCR.
-		   'Processor [info]: cleanup may take a while if stack is huge' infoPrintCR.
-		   p state:#cleanup.
-		   self terminateNoSignal:p.
-		]
-	    ]
-	]
+        "
+         switch failed for some reason -
+         destroy (hard-terminate) the bad process.
+         This happens when:
+         - the stack went above the absolute limit
+           (VM switches back to scheduler)
+         - a halted process cannot execute its interrupt
+           actions (win32 only)
+        "
+        (id := p id) ~~ 0 ifTrue:[
+            id notNil ifTrue:[
+                'Processor [warning]: problem with process ' errorPrint. 
+                id errorPrint. 
+                (nm := p name) notNil ifTrue:[
+                    ' (' errorPrint. nm errorPrint. ')' errorPrint.
+                ].
+
+                ok == #halted ifTrue:[
+                    "/ that process was halted (win32 only)
+                    p state:#halted.
+                   '; stopped it.' errorPrintCR.
+                   self suspend:p.
+                ] ifFalse:[
+                   '; hard-terminate it.' errorPrintCR.
+                   'Processor [info]: cleanup may take a while if stack is huge' infoPrintCR.
+                   p state:#cleanup.
+                   self terminateNoSignal:p.
+                ]
+            ]
+        ]
     ].
     zombie notNil ifTrue:[
-	self class threadDestroy:zombie.
-	zombie := nil
+        self class threadDestroy:zombie.
+        zombie := nil
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+!
+
+threadSwitch:aProcess id:id singleStep:singleStep
+    "continue execution in aProcess.
+     WARNING: this is very a low level entry, no process administration is done here"
+
+    "
+     no interrupts now - activeProcess has already been changed
+     (dont add any message sends here)
+    "
+    activeProcess := aProcess.
+    activeProcessId := id.
+%{
+    extern OBJ ___threadSwitch();
+    OBJ ok;
+
+    if (__isSmallInteger(id)) {
+        ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0);
+    } else {
+        ok = false;
+    }
+    RETURN (ok)
+%}
 ! !
 
 !ProcessorScheduler methodsFor:'priority constants'!
@@ -3112,6 +3124,6 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.186 2000-06-23 08:17:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.187 2000-07-07 14:13:34 cg Exp $'
 ! !
 ProcessorScheduler initialize!