# HG changeset patch # User Claus Gittinger # Date 852822844 -3600 # Node ID dcef47118f0d1517c351206811fa4ebdf9e29708 # Parent 3c531e1ab7c12205611a825df6074e5520ebd83a childSignal if no one runnable diff -r 3c531e1ab7c1 -r dcef47118f0d ProcSched.st --- a/ProcSched.st Thu Jan 09 15:14:09 1997 +0100 +++ b/ProcSched.st Thu Jan 09 16:14:04 1997 +0100 @@ -10,8 +10,6 @@ hereby transferred. " -'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:38' ! - Object subclass:#ProcessorScheduler instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess currentPriority readFdArray readSemaphoreArray readCheckArray @@ -467,7 +465,7 @@ handle all timeout actions " anyTimeouts ifTrue:[ - self evaluateTimeouts + self evaluateTimeouts ]. "first do a quick check for semaphores using checkActions - this is needed for @@ -477,24 +475,30 @@ any := false. nActions := readCheckArray size. 1 to:nActions do:[:index | - 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 - - self waitForEventOrTimeout. - ^ self + "/ no one runnable, hard wait for event or timeout + + self waitForEventOrTimeout. + + "/ check for OS process termination + gotChildSignalInterrupt ifTrue:[ + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt + ]. + ^ self ]. pri := p priority. @@ -525,10 +529,10 @@ " pri < TimingPriority ifTrue:[ - anyTimeouts ifTrue:[ - millis := self timeToNextTimeout. - millis == 0 ifTrue:[^ self]. - ] + anyTimeouts ifTrue:[ + millis := self timeToNextTimeout. + millis == 0 ifTrue:[^ self]. + ] ]. " @@ -541,30 +545,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. ]. " @@ -574,27 +578,28 @@ 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 OS process termination gotChildSignalInterrupt ifTrue:[ - gotChildSignalInterrupt := false. - self handleChildSignalInterrupt + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt ]. "/ check for new input (gotIOInterrupt or:[useIOInterrupts not]) ifTrue:[ - gotIOInterrupt := false. - self checkForInputWithTimeout:0. + gotIOInterrupt := false. + self checkForInputWithTimeout:0. ] "Modified: 12.4.1996 / 10:14:18 / stefan" + "Modified: 9.1.1997 / 16:12:44 / cg" ! dispatchLoop @@ -2308,6 +2313,6 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.102 1997-01-08 19:42:10 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.103 1997-01-09 15:14:04 cg Exp $' ! ! ProcessorScheduler initialize! diff -r 3c531e1ab7c1 -r dcef47118f0d ProcessorScheduler.st --- a/ProcessorScheduler.st Thu Jan 09 15:14:09 1997 +0100 +++ b/ProcessorScheduler.st Thu Jan 09 16:14:04 1997 +0100 @@ -10,8 +10,6 @@ hereby transferred. " -'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:38' ! - Object subclass:#ProcessorScheduler instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess currentPriority readFdArray readSemaphoreArray readCheckArray @@ -467,7 +465,7 @@ handle all timeout actions " anyTimeouts ifTrue:[ - self evaluateTimeouts + self evaluateTimeouts ]. "first do a quick check for semaphores using checkActions - this is needed for @@ -477,24 +475,30 @@ any := false. nActions := readCheckArray size. 1 to:nActions do:[:index | - 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 - - self waitForEventOrTimeout. - ^ self + "/ no one runnable, hard wait for event or timeout + + self waitForEventOrTimeout. + + "/ check for OS process termination + gotChildSignalInterrupt ifTrue:[ + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt + ]. + ^ self ]. pri := p priority. @@ -525,10 +529,10 @@ " pri < TimingPriority ifTrue:[ - anyTimeouts ifTrue:[ - millis := self timeToNextTimeout. - millis == 0 ifTrue:[^ self]. - ] + anyTimeouts ifTrue:[ + millis := self timeToNextTimeout. + millis == 0 ifTrue:[^ self]. + ] ]. " @@ -541,30 +545,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. ]. " @@ -574,27 +578,28 @@ 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 OS process termination gotChildSignalInterrupt ifTrue:[ - gotChildSignalInterrupt := false. - self handleChildSignalInterrupt + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt ]. "/ check for new input (gotIOInterrupt or:[useIOInterrupts not]) ifTrue:[ - gotIOInterrupt := false. - self checkForInputWithTimeout:0. + gotIOInterrupt := false. + self checkForInputWithTimeout:0. ] "Modified: 12.4.1996 / 10:14:18 / stefan" + "Modified: 9.1.1997 / 16:12:44 / cg" ! dispatchLoop @@ -2308,6 +2313,6 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.102 1997-01-08 19:42:10 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.103 1997-01-09 15:14:04 cg Exp $' ! ! ProcessorScheduler initialize!