diff -r c7a000017d17 -r fc084b295df6 ProcessorScheduler.st --- a/ProcessorScheduler.st Thu Jul 22 20:11:49 2010 +0200 +++ b/ProcessorScheduler.st Fri Jul 23 10:39:57 2010 +0200 @@ -1273,7 +1273,21 @@ currentPriority := pri. activeProcess := aProcess. activeProcessId := id. - ok := self threadSwitchFrom:oldProcess to:aProcess id:id singleStep:singleStep. + + " + no interrupts now - activeProcess has already been changed + (dont add any message sends here) + " +"/ ok := self threadSwitchFrom:oldProcess to:aProcess id:id singleStep:singleStep. +%{ + extern OBJ ___threadSwitch(); + + if (__isSmallInteger(id)) { + ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0, 0); + } else { + ok = false; + } +%}. "time passes spent in some other process ... ... here again" @@ -1284,62 +1298,44 @@ 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]. -! - -threadSwitchFrom:oldProcess to: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(); - - if (__isSmallInteger(id)) { - RETURN ( ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0, 0) ); - } - RETURN (false); -%} + + "Modified: / 23-07-2010 / 10:32:11 / cg" ! ! !ProcessorScheduler methodsFor:'priority constants'! @@ -3377,11 +3373,11 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.253 2010-02-09 19:05:37 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.254 2010-07-23 08:39:57 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.253 2010-02-09 19:05:37 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.254 2010-07-23 08:39:57 cg Exp $' ! ! ProcessorScheduler initialize!