--- a/ProcSched.st Wed Feb 28 21:34:53 1996 +0100
+++ b/ProcSched.st Wed Feb 28 21:36:56 1996 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.8 on 5-jan-1996 at 22:01:10' !
-
Object subclass:#ProcessorScheduler
instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess
currentPriority readFdArray readSemaphoreArray readCheckArray
@@ -686,42 +684,43 @@
"/ no interrupt processing, to avoid races with monitorPid
wasBlocked := OperatingSystem blockInterrupts.
-
[
- osProcessStatus := OperatingSystem childProcessWait:blocking.
- osProcessStatus notNil ifTrue:[
- |pid action|
+ [
+ osProcessStatus := OperatingSystem childProcessWait:blocking.
+ osProcessStatus notNil ifTrue:[
+ |pid action|
- pid := osProcessStatus pid.
- osProcessStatus stillAlive ifTrue:[
- action := osChildExitActions at:pid ifAbsent:[].
- ] ifFalse:[
- action := osChildExitActions removeKey:pid ifAbsent:[].
+ pid := osProcessStatus pid.
+ osProcessStatus stillAlive ifTrue:[
+ action := osChildExitActions at:pid ifAbsent:[].
+ ] ifFalse:[
+ action := osChildExitActions removeKey:pid ifAbsent:[].
+ ].
+ action notNil ifTrue:[
+ action value:osProcessStatus
+ ].
].
- action notNil ifTrue:[
- action value:osProcessStatus
- ].
- ].
- "/ if pollChildProcesses does block, poll only one status change.
- "/ we will get another SIGCHLD for other status changes.
+ "/ if pollChildProcesses does block, poll only one status change.
+ "/ we will get another SIGCHLD for other status changes.
- osProcessStatus notNil and:[blocking not]
- ] whileTrue.
+ osProcessStatus notNil and:[blocking not]
+ ] whileTrue.
- "/ if there are no more waiters, disable SIGCHILD handler.
- "/ this helps us with synchronous waiters (e.g. pclose),
- "/ But they should block SIGCHLD anyway.
+ "/ if there are no more waiters, disable SIGCHILD handler.
+ "/ this helps us with synchronous waiters (e.g. pclose),
+ "/ But they should block SIGCHLD anyway.
- osChildExitActions isEmpty ifTrue:[
- OperatingSystem disableChildSignalInterrupts.
- ].
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- .].
+ osChildExitActions isEmpty ifTrue:[
+ OperatingSystem disableChildSignalInterrupts.
+ ].
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
"Created: 22.12.1995 / 14:16:26 / stefan"
"Modified: 5.1.1996 / 16:56:11 / stefan"
+ "Modified: 28.2.1996 / 21:36:31 / cg"
!
monitorPid:pid action:aBlock
@@ -1136,12 +1135,12 @@
"
newPrio := prio.
newPrio < 1 ifTrue:[
- newPrio := 1.
+ newPrio := 1.
] ifFalse:[
- aProcess == scheduler ifTrue:[^ self].
- newPrio > HighestPriority ifTrue:[
- newPrio := HighestPriority
- ]
+ aProcess == scheduler ifTrue:[^ self].
+ newPrio > HighestPriority ifTrue:[
+ newPrio := HighestPriority
+ ]
].
wasBlocked := OperatingSystem blockInterrupts.
@@ -1149,30 +1148,29 @@
aProcess setPriority:newPrio.
oldList := quiescentProcessLists at:oldPrio.
- (oldList identityIndexOf:aProcess) == 0 ifTrue:[
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- ^ self
- ].
+ (oldList identityIndexOf:aProcess) ~~ 0 ifTrue:[
+ oldList remove:aProcess.
- oldList remove:aProcess.
+ newList := quiescentProcessLists at:newPrio.
+ newList addLast:aProcess.
- newList := quiescentProcessLists at:newPrio.
- newList addLast:aProcess.
+ "if its the current process lowering its prio
+ or another one raising, we have to reschedule"
- "if its the current process lowering its prio
- or another one raising, we have to reschedule"
-
- aProcess == activeProcess ifTrue:[
- currentPriority := newPrio.
- newPrio < oldPrio ifTrue:[
- self threadSwitch:scheduler.
- ]
- ] ifFalse:[
- newPrio > currentPriority ifTrue:[
- self threadSwitch:aProcess.
- ]
+ aProcess == activeProcess ifTrue:[
+ currentPriority := newPrio.
+ newPrio < oldPrio ifTrue:[
+ self threadSwitch:scheduler.
+ ]
+ ] ifFalse:[
+ newPrio > currentPriority ifTrue:[
+ self threadSwitch:aProcess.
+ ]
+ ].
].
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+ "Modified: 28.2.1996 / 21:20:47 / cg"
!
interruptActive
@@ -1926,6 +1924,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.68 1996-02-23 15:19:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.69 1996-02-28 20:36:56 cg Exp $'
! !
ProcessorScheduler initialize!
--- a/ProcessorScheduler.st Wed Feb 28 21:34:53 1996 +0100
+++ b/ProcessorScheduler.st Wed Feb 28 21:36:56 1996 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.8 on 5-jan-1996 at 22:01:10' !
-
Object subclass:#ProcessorScheduler
instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess
currentPriority readFdArray readSemaphoreArray readCheckArray
@@ -686,42 +684,43 @@
"/ no interrupt processing, to avoid races with monitorPid
wasBlocked := OperatingSystem blockInterrupts.
-
[
- osProcessStatus := OperatingSystem childProcessWait:blocking.
- osProcessStatus notNil ifTrue:[
- |pid action|
+ [
+ osProcessStatus := OperatingSystem childProcessWait:blocking.
+ osProcessStatus notNil ifTrue:[
+ |pid action|
- pid := osProcessStatus pid.
- osProcessStatus stillAlive ifTrue:[
- action := osChildExitActions at:pid ifAbsent:[].
- ] ifFalse:[
- action := osChildExitActions removeKey:pid ifAbsent:[].
+ pid := osProcessStatus pid.
+ osProcessStatus stillAlive ifTrue:[
+ action := osChildExitActions at:pid ifAbsent:[].
+ ] ifFalse:[
+ action := osChildExitActions removeKey:pid ifAbsent:[].
+ ].
+ action notNil ifTrue:[
+ action value:osProcessStatus
+ ].
].
- action notNil ifTrue:[
- action value:osProcessStatus
- ].
- ].
- "/ if pollChildProcesses does block, poll only one status change.
- "/ we will get another SIGCHLD for other status changes.
+ "/ if pollChildProcesses does block, poll only one status change.
+ "/ we will get another SIGCHLD for other status changes.
- osProcessStatus notNil and:[blocking not]
- ] whileTrue.
+ osProcessStatus notNil and:[blocking not]
+ ] whileTrue.
- "/ if there are no more waiters, disable SIGCHILD handler.
- "/ this helps us with synchronous waiters (e.g. pclose),
- "/ But they should block SIGCHLD anyway.
+ "/ if there are no more waiters, disable SIGCHILD handler.
+ "/ this helps us with synchronous waiters (e.g. pclose),
+ "/ But they should block SIGCHLD anyway.
- osChildExitActions isEmpty ifTrue:[
- OperatingSystem disableChildSignalInterrupts.
- ].
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- .].
+ osChildExitActions isEmpty ifTrue:[
+ OperatingSystem disableChildSignalInterrupts.
+ ].
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
"Created: 22.12.1995 / 14:16:26 / stefan"
"Modified: 5.1.1996 / 16:56:11 / stefan"
+ "Modified: 28.2.1996 / 21:36:31 / cg"
!
monitorPid:pid action:aBlock
@@ -1136,12 +1135,12 @@
"
newPrio := prio.
newPrio < 1 ifTrue:[
- newPrio := 1.
+ newPrio := 1.
] ifFalse:[
- aProcess == scheduler ifTrue:[^ self].
- newPrio > HighestPriority ifTrue:[
- newPrio := HighestPriority
- ]
+ aProcess == scheduler ifTrue:[^ self].
+ newPrio > HighestPriority ifTrue:[
+ newPrio := HighestPriority
+ ]
].
wasBlocked := OperatingSystem blockInterrupts.
@@ -1149,30 +1148,29 @@
aProcess setPriority:newPrio.
oldList := quiescentProcessLists at:oldPrio.
- (oldList identityIndexOf:aProcess) == 0 ifTrue:[
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- ^ self
- ].
+ (oldList identityIndexOf:aProcess) ~~ 0 ifTrue:[
+ oldList remove:aProcess.
- oldList remove:aProcess.
+ newList := quiescentProcessLists at:newPrio.
+ newList addLast:aProcess.
- newList := quiescentProcessLists at:newPrio.
- newList addLast:aProcess.
+ "if its the current process lowering its prio
+ or another one raising, we have to reschedule"
- "if its the current process lowering its prio
- or another one raising, we have to reschedule"
-
- aProcess == activeProcess ifTrue:[
- currentPriority := newPrio.
- newPrio < oldPrio ifTrue:[
- self threadSwitch:scheduler.
- ]
- ] ifFalse:[
- newPrio > currentPriority ifTrue:[
- self threadSwitch:aProcess.
- ]
+ aProcess == activeProcess ifTrue:[
+ currentPriority := newPrio.
+ newPrio < oldPrio ifTrue:[
+ self threadSwitch:scheduler.
+ ]
+ ] ifFalse:[
+ newPrio > currentPriority ifTrue:[
+ self threadSwitch:aProcess.
+ ]
+ ].
].
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+ "Modified: 28.2.1996 / 21:20:47 / cg"
!
interruptActive
@@ -1926,6 +1924,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.68 1996-02-23 15:19:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.69 1996-02-28 20:36:56 cg Exp $'
! !
ProcessorScheduler initialize!