--- a/ProcessorScheduler.st Wed Jan 28 13:15:27 2004 +0100
+++ b/ProcessorScheduler.st Wed Jan 28 14:06:33 2004 +0100
@@ -1066,6 +1066,87 @@
]
"Modified: / 28.9.1998 / 11:36:53 / cg"
+!
+
+vmResumeInterrupt:id
+ "{ Pragma: +returnable }"
+
+ "signal from VM to resume a thread after finish of an osWait or wrapCall-wait.
+ MUST be invoked with interrupts blocked.
+ This is only used with native threads."
+
+ |index pri aProcess l|
+
+ OperatingSystem interruptsBlocked ifFalse:[
+ 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:[
+ aProcess state:#run.
+ ^ self
+ ].
+ 'ProcSched [info]: oops - resumeIRQ for already running process' 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.
+ ]
+
+ "Modified: / 28.9.1998 / 11:36:53 / cg"
+!
+
+vmSuspendInterrupt:newState
+ "{ Pragma: +returnable }"
+
+ "signal from VM to suspend a thread into a certain state.
+ Invoked before the VM switches to the scheduler process.
+ MUST be invoked with interrupts blocked.
+ This is only used with native threads."
+
+ |pri l|
+
+ OperatingSystem interruptsBlocked ifFalse:[
+ MiniDebugger
+ enterWithMessage:'immediateInterrupt with no interruptsBlocked'
+ mayProceed:true.
+ ].
+
+ activeProcess setStateTo:newState if:#active.
+
+ pri := activeProcess priority.
+ l := quiescentProcessLists at:pri.
+
+ "notice: this is slightly faster than putting the if-code into
+ the ifAbsent block, because [] is a shared cheap block, created at compile time
+ "
+ (l isNil or:[(l remove:activeProcess ifAbsent:nil) isNil]) ifTrue:[
+ "/ 'Processor [warning]: bad vmSuspendInterrupt: not on run list' errorPrintCR.
+ MiniDebugger enterWithMessage:'bad vmSuspendInterrupt: not on run list' mayProceed:true.
+ ^ self
+ ].
! !
!ProcessorScheduler methodsFor:'os process handling'!
@@ -3321,7 +3402,7 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.214 2003-11-18 15:49:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.215 2004-01-28 13:06:33 ca Exp $'
! !
ProcessorScheduler initialize!