ProcessorScheduler.st
changeset 12717 594a44c45567
parent 11836 0d70352a70bc
child 12958 fc084b295df6
--- a/ProcessorScheduler.st	Tue Feb 09 19:57:57 2010 +0100
+++ b/ProcessorScheduler.st	Tue Feb 09 20:05:37 2010 +0100
@@ -979,55 +979,44 @@
     |index pri aProcess l|
 
     OperatingSystem interruptsBlocked ifFalse:[
-	MiniDebugger
-	    enterWithMessage:'vmResumeInterrupt with no interruptsBlocked'
-	    mayProceed:true.
+        MiniDebugger
+            enterWithMessage:'vmResumeInterrupt with no interruptsBlocked'
+            mayProceed:true.
     ].
 
     index := KnownProcessIds identityIndexOf:id.
     index ~~ 0 ifTrue:[
-	aProcess := KnownProcesses at:index.
-	"/
-	"/ CG: the situation below may happen, if the wrapCall
-	"/ finishes before the process was layed to sleep
-	"/ (i.e. schedulerIRQ arrives before the threadSwitch was finished).
-	"/ In that case, simply resume it and everything is OK.
-	"/
-	pri := aProcess priority.
-	l := quiescentProcessLists at:pri.
-	"if already running, ignore"
-	l notNil ifTrue:[
-	    (l identityIndexOf:aProcess) ~~ 0 ifTrue:[
-		aProcess state == #wrapWait ifTrue:[
-		   'ProcSched [info]: resumeIRQ for wrapWait process ' infoPrintCR.
-		    aProcess state:#run.
-		    ^ self
-		].
-		aProcess state == #osWait ifTrue:[
-		   'ProcSched [info]: resumeIRQ for osWait process ' infoPrintCR.
-		    aProcess state:#run.
-		    ^ self
-		].
-		aProcess state == #stopped ifTrue:[
-		   'ProcSched [info]: resumeIRQ for stopped process ' infoPrintCR.
-		    aProcess state:#run.
-		    ^ self
-		].
-		'ProcSched [info]: oops - resumeIRQ for already running process ' infoPrint.
-		aProcess id infoPrint.
-		' in state ' infoPrint.
-		aProcess state infoPrintCR.
-		^ self
-	    ]
-	] ifFalse:[
-	    l := LinkedList new.
-	    quiescentProcessLists at:pri put:l.
-	].
-	l addLast:aProcess.
-	aProcess state:#run.
+        aProcess := KnownProcesses at:index.
+        pri := aProcess priority.
+        l := quiescentProcessLists at:pri.
+        l notNil ifTrue:[
+            (l includesIdentical:aProcess) ifTrue:[
+                "/ aProcess is on a run queue.
+                "/ CG: this situation may happen, if the wrapCall
+                "/ finishes before the process was layed to sleep
+                "/ (i.e. schedulerIRQ arrives before the threadSwitch was finished).
+                "/ In that case, simply resume it and everything is OK.
+                "/ If the process is state running, ignore.
+
+                |state|
+
+                state := aProcess state.
+                (state == #wrapWait or:[state == #osWait] or:[state == #stopped]) ifTrue:[
+                    aProcess state:#run.
+                ].
+                'ProcSched [info]: resumeIRQ ignored for process: ' infoPrint.
+                aProcess id infoPrint. ' in state: ' infoPrint. state infoPrintCR.
+                ^ self
+            ]
+        ] ifFalse:[
+            l := LinkedList new.
+            quiescentProcessLists at:pri put:l.
+        ].
+        l addLast:aProcess.
+        aProcess state:#run.
     ] ifFalse:[
-	'ProcSched [info]: oops - resumeIRQ for unknown process: ' infoPrint.
-	id infoPrintCR.
+        'ProcSched [info]: resumeIRQ for unknown process: ' infoPrint.
+        id infoPrintCR.
     ]
 
     "Modified: / 28.9.1998 / 11:36:53 / cg"
@@ -3388,7 +3377,11 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.252 2009-08-05 09:12:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.253 2010-02-09 19:05:37 stefan Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.253 2010-02-09 19:05:37 stefan Exp $'
 ! !
 
 ProcessorScheduler initialize!