ProcessorScheduler.st
changeset 7842 c6ce40656157
parent 7761 748613a5ed16
child 7843 922a4285375a
equal deleted inserted replaced
7841:c25e1dc957b8 7842:c6ce40656157
  1064 	'ProcSched [info]: oops - resumeIRQ for unknown process: ' infoPrint.
  1064 	'ProcSched [info]: oops - resumeIRQ for unknown process: ' infoPrint.
  1065 	id infoPrintCR.
  1065 	id infoPrintCR.
  1066     ]
  1066     ]
  1067 
  1067 
  1068     "Modified: / 28.9.1998 / 11:36:53 / cg"
  1068     "Modified: / 28.9.1998 / 11:36:53 / cg"
       
  1069 !
       
  1070 
       
  1071 vmResumeInterrupt:id
       
  1072     "{ Pragma: +returnable }"
       
  1073 
       
  1074     "signal from VM to resume a thread after finish of an osWait or wrapCall-wait. 
       
  1075      MUST be invoked with interrupts blocked.
       
  1076      This is only used with native threads."
       
  1077 
       
  1078     |index pri aProcess l|
       
  1079 
       
  1080     OperatingSystem interruptsBlocked ifFalse:[
       
  1081         MiniDebugger 
       
  1082             enterWithMessage:'vmResumeInterrupt with no interruptsBlocked'
       
  1083             mayProceed:true.
       
  1084     ].
       
  1085 
       
  1086     index := KnownProcessIds identityIndexOf:id.
       
  1087     index ~~ 0 ifTrue:[
       
  1088         aProcess := KnownProcesses at:index.
       
  1089         "/
       
  1090         "/ CG: the situation below may happen, if the wrapCall
       
  1091         "/ finishes before the process was layed to sleep
       
  1092         "/ (i.e. schedulerIRQ arrives before the threadSwitch was finished).
       
  1093         "/ In that case, simply resume it and everything is OK.
       
  1094         "/
       
  1095         pri := aProcess priority.
       
  1096         l := quiescentProcessLists at:pri.
       
  1097         "if already running, ignore"
       
  1098         l notNil ifTrue:[
       
  1099             (l identityIndexOf:aProcess) ~~ 0 ifTrue:[
       
  1100                 aProcess state == #wrapWait ifTrue:[
       
  1101                     aProcess state:#run.
       
  1102                     ^ self
       
  1103                 ].
       
  1104                 'ProcSched [info]: oops - resumeIRQ for already running process' infoPrintCR.
       
  1105                 ^ self
       
  1106             ]
       
  1107         ] ifFalse:[
       
  1108             l := LinkedList new.
       
  1109             quiescentProcessLists at:pri put:l.
       
  1110         ].
       
  1111         l addLast:aProcess.
       
  1112         aProcess state:#run.
       
  1113     ] ifFalse:[
       
  1114         'ProcSched [info]: oops - resumeIRQ for unknown process: ' infoPrint.
       
  1115         id infoPrintCR.
       
  1116     ]
       
  1117 
       
  1118     "Modified: / 28.9.1998 / 11:36:53 / cg"
       
  1119 !
       
  1120 
       
  1121 vmSuspendInterrupt:newState
       
  1122     "{ Pragma: +returnable }"
       
  1123 
       
  1124     "signal from VM to suspend a thread into a certain state.
       
  1125      Invoked before the VM switches to the scheduler process. 
       
  1126      MUST be invoked with interrupts blocked.
       
  1127      This is only used with native threads."
       
  1128 
       
  1129     |pri l|
       
  1130 
       
  1131     OperatingSystem interruptsBlocked ifFalse:[
       
  1132         MiniDebugger 
       
  1133             enterWithMessage:'immediateInterrupt with no interruptsBlocked'
       
  1134             mayProceed:true.
       
  1135     ].
       
  1136 
       
  1137     activeProcess setStateTo:newState if:#active.
       
  1138 
       
  1139     pri := activeProcess priority.
       
  1140     l := quiescentProcessLists at:pri.
       
  1141 
       
  1142     "notice: this is slightly faster than putting the if-code into
       
  1143      the ifAbsent block, because [] is a shared cheap block, created at compile time
       
  1144     "
       
  1145     (l isNil or:[(l remove:activeProcess ifAbsent:nil) isNil]) ifTrue:[
       
  1146         "/ 'Processor [warning]: bad vmSuspendInterrupt: not on run list' errorPrintCR.
       
  1147         MiniDebugger enterWithMessage:'bad vmSuspendInterrupt: not on run list' mayProceed:true.
       
  1148         ^ self
       
  1149     ].
  1069 ! !
  1150 ! !
  1070 
  1151 
  1071 !ProcessorScheduler methodsFor:'os process handling'!
  1152 !ProcessorScheduler methodsFor:'os process handling'!
  1072 
  1153 
  1073 childSignalInterrupt
  1154 childSignalInterrupt
  3319 ! !
  3400 ! !
  3320 
  3401 
  3321 !ProcessorScheduler class methodsFor:'documentation'!
  3402 !ProcessorScheduler class methodsFor:'documentation'!
  3322 
  3403 
  3323 version
  3404 version
  3324     ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.214 2003-11-18 15:49:53 cg Exp $'
  3405     ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.215 2004-01-28 13:06:33 ca Exp $'
  3325 ! !
  3406 ! !
  3326 
  3407 
  3327 ProcessorScheduler initialize!
  3408 ProcessorScheduler initialize!