--- a/ProcessorScheduler.st Thu Dec 21 18:10:58 1995 +0100
+++ b/ProcessorScheduler.st Fri Dec 22 23:22:15 1995 +0100
@@ -502,7 +502,7 @@
handle all timeout actions
"
anyTimeouts ifTrue:[
- self evaluateTimeouts
+ self evaluateTimeouts
].
"first do a quick check for semaphores using checkActions - this is needed for
@@ -512,26 +512,26 @@
any := false.
nActions := readCheckArray size.
1 to:nActions do:[:index |
- |checkBlock sema|
+ |checkBlock sema|
- checkBlock := readCheckArray at:index.
- (checkBlock notNil and:[checkBlock value]) ifTrue:[
- sema := readSemaphoreArray at:index.
- sema notNil ifTrue:[
- sema signalOnce.
- ].
- any := true.
- ]
+ checkBlock := readCheckArray at:index.
+ (checkBlock notNil and:[checkBlock value]) ifTrue:[
+ sema := readSemaphoreArray at:index.
+ sema notNil ifTrue:[
+ sema signalOnce.
+ ].
+ any := true.
+ ]
].
"now, someone might be runnable ..."
p := self highestPriorityRunnableProcess.
p isNil ifTrue:[
- "no one runnable, hard wait for event or timeout"
+ "no one runnable, hard wait for event or timeout"
- self waitForEventOrTimeout.
- ^ self
+ self waitForEventOrTimeout.
+ ^ self
].
pri := p priority.
@@ -562,10 +562,10 @@
"
pri < TimingPriority ifTrue:[
- anyTimeouts ifTrue:[
- millis := self timeToNextTimeout.
- millis == 0 ifTrue:[^ self].
- ]
+ anyTimeouts ifTrue:[
+ millis := self timeToNextTimeout.
+ millis == 0 ifTrue:[^ self].
+ ]
].
"
@@ -578,30 +578,30 @@
pri < UserInterruptPriority ifTrue:[
"comment out this if above is uncommented"
- anyTimeouts ifTrue:[
- millis := self timeToNextTimeout.
- millis == 0 ifTrue:[^ self].
- ].
+ anyTimeouts ifTrue:[
+ millis := self timeToNextTimeout.
+ millis == 0 ifTrue:[^ self].
+ ].
"---"
- useIOInterrupts ifTrue:[
- readFdArray do:[:fd |
- fd notNil ifTrue:[
- OperatingSystem enableIOInterruptsOn:fd
- ].
- ].
- ] ifFalse:[
- millis notNil ifTrue:[
- millis := millis min:50
- ] ifFalse:[
- millis := 50
- ]
- ]
+ useIOInterrupts ifTrue:[
+ readFdArray do:[:fd |
+ fd notNil ifTrue:[
+ OperatingSystem enableIOInterruptsOn:fd
+ ].
+ ].
+ ] ifFalse:[
+ millis notNil ifTrue:[
+ millis := millis min:50
+ ] ifFalse:[
+ millis := 50
+ ]
+ ]
].
millis notNil ifTrue:[
- "schedule a clock interrupt after millis milliseconds"
- OperatingSystem enableTimer:millis rounded.
+ "schedule a clock interrupt after millis milliseconds"
+ OperatingSystem enableTimer:millis rounded.
].
"
@@ -611,18 +611,18 @@
self threadSwitch:p.
"... when we arrive here, we are back on stage.
- Either by an ALARM or IO signal, or by a suspend of another process
+ Either by an ALARM or IO signal, or by a suspend of another process
"
millis notNil ifTrue:[
- OperatingSystem disableTimer.
+ OperatingSystem disableTimer.
].
"/ check for new input
(gotIOInterrupt or:[useIOInterrupts not]) ifTrue:[
- gotIOInterrupt := false.
- self checkForInputWithTimeout:0.
+ gotIOInterrupt := false.
+ self checkForInputWithTimeout:0.
]
"Modified: 21.12.1995 / 16:21:54 / stefan"
@@ -632,7 +632,7 @@
"central dispatch loop; the scheduler process is always staying in
this method, looping forever."
- |dispatchAction|
+ |dispatchAction handlerAction ignoredSignals|
"avoid confusion if entered twice"
@@ -640,16 +640,24 @@
dispatching := true.
dispatchAction := [self dispatch].
+ handlerAction := [:ex |
+ 'PROCESSOR: ignored signal' infoPrintNL.
+ ex return
+ ].
+
+ ignoredSignals := SignalSet
+ with:(Process terminateSignal)
+ with:AbortSignal.
"/
"/ I made this an extra call to dispatch; this allows recompilation
"/ of the dispatch-handling code in the running system.
"/
[true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:dispatchAction
+ ignoredSignals handle:handlerAction do:dispatchAction
]
+
+ "Modified: 22.12.1995 / 23:12:51 / cg"
! !
!ProcessorScheduler methodsFor:'primitive process primitives'!
@@ -804,9 +812,9 @@
l p|
KnownProcesses isNil ifTrue:[
- KnownProcesses := WeakArray new:10.
- KnownProcesses watcher:self class.
- KnownProcessIds := OrderedCollection new.
+ KnownProcesses := WeakArray new:10.
+ KnownProcesses watcher:self class.
+ KnownProcessIds := OrderedCollection new.
].
"
@@ -815,7 +823,7 @@
nPrios := SchedulingPriority.
quiescentProcessLists := Array new:nPrios.
1 to:nPrios do:[:pri |
- quiescentProcessLists at:pri put:(LinkedList new)
+ quiescentProcessLists at:pri put:(LinkedList new)
].
readFdArray := Array with:nil.
@@ -1129,17 +1137,16 @@
some debugging stuff
"
aProcess isNil ifTrue:[
- MiniDebugger enterWithMessage:'nil suspend'.
+ MiniDebugger enterWithMessage:'PROCESSOR: nil suspend'.
^ self
].
aProcess id isNil ifTrue:[
- MiniDebugger enterWithMessage:'bad suspend: already dead'.
+ MiniDebugger enterWithMessage:'PROCESSOR: bad suspend: already dead'.
self threadSwitch:scheduler.
^ self
].
aProcess == scheduler ifTrue:[
- 'scheduler should never be suspended' errorPrintNL.
- MiniDebugger enterWithMessage:'scheduler should never be suspended'.
+ MiniDebugger enterWithMessage:'PROCESSOR: scheduler should never be suspended'.
^ self
].
@@ -1153,7 +1160,7 @@
"
(l remove:aProcess ifAbsent:[]) isNil ifTrue:[
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- 'bad suspend: not on run list' errorPrintNL.
+ 'PROCESSOR: bad suspend: not on run list' errorPrintNL.
"/ MiniDebugger enterWithMessage:'bad suspend: not on run list'.
self threadSwitch:scheduler.
^ self
@@ -1172,6 +1179,7 @@
].
"Modified: 13.12.1995 / 13:32:11 / stefan"
+ "Modified: 22.12.1995 / 23:10:12 / cg"
!
terminate:aProcess
@@ -1775,6 +1783,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.60 1995-12-21 16:56:47 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.61 1995-12-22 22:22:15 cg Exp $'
! !
ProcessorScheduler initialize!