ProcessorScheduler.st
changeset 217 a0400fdbc933
parent 213 3b56a17534fd
child 231 fd0e55e352f8
--- a/ProcessorScheduler.st	Thu Feb 02 13:23:05 1995 +0100
+++ b/ProcessorScheduler.st	Thu Feb 02 13:25:49 1995 +0100
@@ -32,7 +32,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.26 1995-02-02 12:25:35 claus Exp $
 '!
 
 Smalltalk at:#Processor put:nil!
@@ -55,7 +55,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.26 1995-02-02 12:25:35 claus Exp $
 "
 !
 
@@ -299,8 +299,10 @@
     aProcess state:#active.
     oldProcess setStateTo:#run if:#active.
 
-    "no interrupts now - activeProcess has already been changed
-     (dont add any message sends here)"
+    "
+     no interrupts now - activeProcess has already been changed
+     (dont add any message sends here)
+    "
     activeProcess := aProcess.
     currentPriority := pri.
 %{
@@ -311,23 +313,18 @@
     else
 	ok = __threadSwitch(__context, _intVal(id));
 %}.
-    "time passes ...
+    "time passes spent in some other process ...
      ... here again"
 
-	p := activeProcess.
-	activeProcess := oldProcess.
-	currentPriority := oldPri.
+    p := activeProcess.
+    activeProcess := oldProcess.
+    currentPriority := oldPri.
 
     ok ifFalse:[
 	"
 	 switch failed for some reason -
 	 destroy the bad process
 	"
-"
-	p := activeProcess.
-	activeProcess := oldProcess.
-	currentPriority := oldPri.
-"
 	p id ~~ 0 ifTrue:[
 	    'problem with process ' errorPrint. p id errorPrint. ' terminate it.' errorPrintNL.
 	    p state:#suspended.
@@ -342,7 +339,7 @@
 !
 
 scheduleForInterrupt:aProcess
-    "make aProcess evaluate its pushedInterrupt block(s)"
+    "make aProcess evaluate its pushed interrupt block(s)"
 
     |id|
 
@@ -644,7 +641,7 @@
     ].
     aProcess == scheduler ifTrue:[
 	'scheduler should never be suspended' printNL.
-	"/ MiniDebugger enterWithMessage:'scheduler should never be suspended'.
+	MiniDebugger enterWithMessage:'scheduler should never be suspended'.
 	^ self
     ].
 
@@ -993,6 +990,24 @@
 	]
     ].
     ^ nil
+!
+
+activeProcessIsSystemProcess
+    "return true if the active process is a system process,
+     which should not be suspended."
+
+    |active|
+
+    (self class isPureEventDriven 
+    or:[(active := self activeProcess) id == 0
+    or:[active nameOrId endsWith:'dispatcher']]) ifTrue:[
+	^ true
+    ].
+    ^ false
+
+    "
+     Processor activeProcessIsSystemProcess
+    "
 ! !
 
 !ProcessorScheduler methodsFor:'dispatching'!