ProcessorScheduler.st
changeset 2534 6ac73e757c70
parent 2499 95392696facc
child 2611 9a575397bf9a
--- a/ProcessorScheduler.st	Mon Apr 07 19:33:25 1997 +0200
+++ b/ProcessorScheduler.st	Fri Apr 11 11:35:42 1997 +0200
@@ -103,11 +103,11 @@
 						number of processes are allowed
 						(for debugging)
 
-	TimeSliceInterval			for preemptive priority scheduling only:
+	TimeSliceInterval                       for preemptive priority scheduling only:
 						the time interval in millis, at which processes
 						are timesliced
-						
-	TimeSlicingPriorityLimit		for preemptive priority scheduling only:
+                                                
+	TimeSlicingPriorityLimit                for preemptive priority scheduling only:
 						processes are only timesliced, if running 
 						at or below this priority.
 
@@ -169,7 +169,7 @@
 
     WARNING:
 	timesliced priority scheduling is an experimental feature. There is no warranty,
-        (at the moment), that the system runs reliable in this mode.
+	(at the moment), that the system runs reliable in this mode.
 	The problem is, that shared collections may now be easily modified by other
 	processes, running at the same time. 
 	The class library is currently being investigated for such possible trouble spots 
@@ -198,15 +198,15 @@
     SchedulingPriority := 31.
 
     InvalidProcessSignal isNil ifTrue:[
-        InvalidProcessSignal := ErrorSignal newSignalMayProceed:true.
-        InvalidProcessSignal nameClass:self message:#invalidProcessSignal.
-        InvalidProcessSignal notifierString:'invalid process'.
+	InvalidProcessSignal := ErrorSignal newSignalMayProceed:true.
+	InvalidProcessSignal nameClass:self message:#invalidProcessSignal.
+	InvalidProcessSignal notifierString:'invalid process'.
     ].
 
     Processor isNil ifTrue:[
-        "create the one and only processor"
-
-        Processor := self basicNew initialize.
+	"create the one and only processor"
+
+	Processor := self basicNew initialize.
     ].
 
     "
@@ -215,7 +215,7 @@
     "
     PureEventDriven := self threadsAvailable not.
     PureEventDriven ifTrue:[
-        'Processor [error]: no process support - running event driven' errorPrintCR
+	'Processor [error]: no process support - running event driven' errorPrintCR
     ].
 
     "Modified: 23.9.1996 / 14:24:50 / stefan"
@@ -249,22 +249,22 @@
     |id sz "{ Class: SmallInteger }"|
 
     something == #ElementExpired ifTrue:[
-        sz := KnownProcessIds size.
-        1 to:sz do:[:index |
-            "/ (KnownProcesses at:index) isNil ifTrue:[
-            (KnownProcesses at:index) == 0 ifTrue:[
-                id := KnownProcessIds at:index.
-                id notNil ifTrue:[
-                    'Processor [warning]: terminating thread ' errorPrint.
-                    id errorPrint.
-                    ' (no longer refd)' errorPrintCR.
-
-                    self threadDestroy:id.
-                    KnownProcessIds at:index put:nil.
-                ].
-                KnownProcesses at:index put:nil.
-            ]
-        ]
+	sz := KnownProcessIds size.
+	1 to:sz do:[:index |
+	    "/ (KnownProcesses at:index) isNil ifTrue:[
+	    (KnownProcesses at:index) == 0 ifTrue:[
+		id := KnownProcessIds at:index.
+		id notNil ifTrue:[
+		    'Processor [warning]: terminating thread ' errorPrint.
+		    id errorPrint.
+		    ' (no longer refd)' errorPrintCR.
+
+		    self threadDestroy:id.
+		    KnownProcessIds at:index put:nil.
+		].
+		KnownProcesses at:index put:nil.
+	    ]
+	]
     ]
 
     "Created: 7.1.1997 / 16:45:42 / stefan"
@@ -532,7 +532,7 @@
      handle all timeout actions
     "
     anyTimeouts ifTrue:[
-        self evaluateTimeouts
+	self evaluateTimeouts
     ].
 
     "first do a quick check for semaphores using checkActions - this is needed for
@@ -542,30 +542,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.
-
-        "/ check for OS process termination
-        gotChildSignalInterrupt ifTrue:[
-            gotChildSignalInterrupt := false.
-            self handleChildSignalInterrupt
-        ].
-        ^ 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.
@@ -596,10 +596,10 @@
 
 "
     pri < TimingPriority ifTrue:[
-        anyTimeouts ifTrue:[
-            millis := self timeToNextTimeout.
-            millis == 0 ifTrue:[^ self].
-        ]
+	anyTimeouts ifTrue:[
+	    millis := self timeToNextTimeout.
+	    millis == 0 ifTrue:[^ self].
+	]
     ].
 "
 
@@ -612,30 +612,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.
     ].
 
     "
@@ -645,24 +645,24 @@
     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"
@@ -688,20 +688,20 @@
     dispatchAction := [self dispatch].
 
     handlerAction := [:ex |
-                        ('Processor [info]: ignored signal (', ex signal printString, ')') infoPrintCR.
-                        ex return
-                     ].
+			('Processor [info]: ignored signal (', ex signal printString, ')') infoPrintCR.
+			ex return
+		     ].
 
     ignoredSignals := SignalSet 
-                        with:(Process terminateSignal)
-                        with:AbortSignal.
+			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.
     "/
     [dispatching] whileTrue:[
-        ignoredSignals handle:handlerAction do:dispatchAction
+	ignoredSignals handle:handlerAction do:dispatchAction
     ].
 
     "/ we arrive here in standalone Apps,
@@ -804,31 +804,31 @@
     |pid blocked osProcessStatus|
 
     OperatingSystem sigCHLD ~= 0 ifTrue:[
-        "/ SIGCHLD is supported,
-        "/ aBlock will be evaluated, as soon as a SIGCHLD interrupt for pid has been received.
-        OperatingSystem enableChildSignalInterrupts.
-        blocked := OperatingSystem blockInterrupts.
-        pid := aBlockReturningPid value.
-        pid notNil ifTrue:[
-            osChildExitActions at:pid put:actionBlock.
-        ].
-        blocked ifFalse:[
-            OperatingSystem unblockInterrupts.
-        ].
+	"/ SIGCHLD is supported,
+	"/ aBlock will be evaluated, as soon as a SIGCHLD interrupt for pid has been received.
+	OperatingSystem enableChildSignalInterrupts.
+	blocked := OperatingSystem blockInterrupts.
+	pid := aBlockReturningPid value.
+	pid notNil ifTrue:[
+	    osChildExitActions at:pid put:actionBlock.
+	].
+	blocked ifFalse:[
+	    OperatingSystem unblockInterrupts.
+	].
     ] ifFalse:[
-        "/ SIGCHLD is not supported, wait synchronously for the exit
-        "/ of pid.
-
-        pid := aBlockReturningPid value.
-        [
-            osProcessStatus := OperatingSystem childProcessWait:true.
-            osProcessStatus notNil ifTrue:[
-                (osProcessStatus pid = pid) ifTrue:[
-                    actionBlock value:osProcessStatus.
-                ].
-                osProcessStatus stillAlive
-            ].
-        ] whileTrue.
+	"/ SIGCHLD is not supported, wait synchronously for the exit
+	"/ of pid.
+
+	pid := aBlockReturningPid value.
+	[
+	    osProcessStatus := OperatingSystem childProcessWait:true.
+	    osProcessStatus notNil ifTrue:[
+		(osProcessStatus pid = pid) ifTrue:[
+		    actionBlock value:osProcessStatus.
+		].
+		osProcessStatus stillAlive
+	    ].
+	] whileTrue.
     ].
     ^ pid
 
@@ -909,9 +909,9 @@
     extern OBJ ___threadSwitch();
 
     if (__isSmallInteger(id)) {
-        ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0);
+	ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0);
     } else {
-        ok = false;
+	ok = false;
     }
 %}.
     "time passes spent in some other process ...
@@ -923,25 +923,25 @@
     currentPriority := oldProcess priority.
 
     ok ifFalse:[
-        "
-         switch failed for some reason -
-         destroy the bad process
-        "
-        p id ~~ 0 ifTrue:[
-            'Processor [warning]: problem with process ' errorPrint. 
-                p id errorPrint. 
-                p name notNil ifTrue:[
-                    ' (' errorPrint. p name errorPrint. ')' errorPrint.
-                ].
-                '; hard-terminate it.' errorPrintCR.
+	"
+	 switch failed for some reason -
+	 destroy the bad process
+	"
+	p id ~~ 0 ifTrue:[
+	    'Processor [warning]: problem with process ' errorPrint. 
+		p id errorPrint. 
+		p name notNil ifTrue:[
+		    ' (' errorPrint. p name errorPrint. ')' errorPrint.
+		].
+		'; hard-terminate it.' errorPrintCR.
 	    'Processor [info]: cleanup may take a while if stack is huge' infoPrintCR.
-            p state:#suspended.
-            self terminateNoSignal:p.
-        ]
+	    p state:#suspended.
+	    self terminateNoSignal:p.
+	]
     ].
     zombie notNil ifTrue:[
-        self class threadDestroy:zombie.
-        zombie := nil
+	self class threadDestroy:zombie.
+	zombie := nil
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 ! !
@@ -1047,17 +1047,17 @@
     index := 1.
     sz := KnownProcessIds size.
     [index <= sz] whileTrue:[
-        (KnownProcesses at:index) isNil ifTrue:[
-            oldId := KnownProcessIds at:index.
-            oldId notNil ifTrue:[
-                self class threadDestroy:oldId.
-            ].
-            KnownProcesses at:index put:aProcess.
-            KnownProcessIds at:index put:aProcess id.
-            wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-            ^ self
-        ].
-        index := index + 1
+	(KnownProcesses at:index) isNil ifTrue:[
+	    oldId := KnownProcessIds at:index.
+	    oldId notNil ifTrue:[
+		self class threadDestroy:oldId.
+	    ].
+	    KnownProcesses at:index put:aProcess.
+	    KnownProcessIds at:index put:aProcess id.
+	    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	    ^ self
+	].
+	index := index + 1
     ].
 
     KnownProcessIds grow:index.
@@ -1065,10 +1065,10 @@
 
     oldSize := KnownProcesses size.
     (index > oldSize) ifTrue:[
-        newShadow := WeakArray new:(oldSize * 2).
-        newShadow addDependent:self class.
-        newShadow replaceFrom:1 with:KnownProcesses.
-        KnownProcesses := newShadow
+	newShadow := WeakArray new:(oldSize * 2).
+	newShadow addDependent:self class.
+	newShadow replaceFrom:1 with:KnownProcesses.
+	KnownProcesses := newShadow
     ].
     KnownProcesses at:index put:aProcess.
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
@@ -1099,9 +1099,9 @@
      p l|
 
     KnownProcesses isNil ifTrue:[
-        KnownProcesses := WeakArray new:30.
-        KnownProcesses addDependent:self class.
-        KnownProcessIds := OrderedCollection new.
+	KnownProcesses := WeakArray new:30.
+	KnownProcesses addDependent:self class.
+	KnownProcessIds := OrderedCollection new.
     ].
 
     "
@@ -1179,16 +1179,16 @@
     "
     processesToRestart := OrderedCollection new.
     KnownProcesses do:[:p |
-        (p notNil and:[p ~~ 0]) ifTrue:[
-            "how, exactly should this be done ?"
-
-            p isRestartable == true ifTrue:[
-                p nextLink:nil.
-                processesToRestart add:p
-            ] ifFalse:[
-                p setId:nil state:#dead
-            ]
-        ].
+	(p notNil and:[p ~~ 0]) ifTrue:[
+	    "how, exactly should this be done ?"
+
+	    p isRestartable == true ifTrue:[
+		p nextLink:nil.
+		processesToRestart add:p
+	    ] ifFalse:[
+		p setId:nil state:#dead
+	    ]
+	].
     ].
     scheduler setId:nil state:#dead. 
 
@@ -1202,7 +1202,7 @@
      ... and restart those that can be.
     "
     processesToRestart do:[:p |
-        p imageRestart
+	p imageRestart
     ]
 
     "Modified: 28.10.1996 / 20:45:54 / cg"
@@ -1231,11 +1231,11 @@
     "private entry for Process restart - do not use in your program"
 
     idWant isNil ifTrue:[
-        ^ self newProcessFor:aProcess
+	^ self newProcessFor:aProcess
     ].
 
     (self class threadCreate:aProcess withId:idWant) ~~ idWant ifTrue:[
-        ^ false
+	^ false
     ].
 
     aProcess state:#light.   "meaning: has no stack yet"
@@ -1298,22 +1298,22 @@
     prio := HighestPriority.
     listArray := quiescentProcessLists.
     [prio >= 1] whileTrue:[
-        l := listArray at:prio.
-        l notNil ifTrue:[
-            l isEmpty ifFalse:[
-                p := l first.
-                "
-                 if it got corrupted somehow ...
-                "
-                p id isNil ifTrue:[
-                    'Processor [warning]: process with nil id removed' errorPrintCR.
-                    l removeFirst.
-                    ^ nil.
-                ].
-                ^ p
-            ]
-        ].
-        prio := prio - 1
+	l := listArray at:prio.
+	l notNil ifTrue:[
+	    l isEmpty ifFalse:[
+		p := l first.
+		"
+		 if it got corrupted somehow ...
+		"
+		p id isNil ifTrue:[
+		    'Processor [warning]: process with nil id removed' errorPrintCR.
+		    l removeFirst.
+		    ^ nil.
+		].
+		^ p
+	    ]
+	].
+	prio := prio - 1
     ].
     ^ nil
 
@@ -1343,9 +1343,8 @@
 
     (PureEventDriven 
     or:[aProcess id == 0
-    or:[aProcess priority >= UserInterruptPriority
+    or:[aProcess processGroupId == 0
     or:[(Display notNil and:[Display dispatchProcess == aProcess])
-	" nameOrId endsWith:'dispatcher' "
     ]]]) ifTrue:[
 	^ true
     ].
@@ -1386,44 +1385,44 @@
     "
     newPrio := prio.
     newPrio < 1 ifTrue:[
-        newPrio := 1.
+	newPrio := 1.
     ] ifFalse:[
-        newPrio > HighestPriority ifTrue:[
-            newPrio := HighestPriority
-        ]
+	newPrio > HighestPriority ifTrue:[
+	    newPrio := HighestPriority
+	]
     ].
 
     [
-        wasBlocked := OperatingSystem blockInterrupts.
-
-        aProcess setPriority:newPrio.
-
-        oldList := quiescentProcessLists at:oldPrio.
-        oldList notNil ifTrue:[
-            (oldList remove:aProcess ifAbsent:nil) notNil ifTrue:[
-                newList := quiescentProcessLists at:newPrio.
-                newList isNil ifTrue:[
-                    quiescentProcessLists at:newPrio put:(newList := LinkedList new).
-                ].
-                newList addLast:aProcess.
-
-                "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.
-                    ]
-                ].
-            ]
-        ]
+	wasBlocked := OperatingSystem blockInterrupts.
+
+	aProcess setPriority:newPrio.
+
+	oldList := quiescentProcessLists at:oldPrio.
+	oldList notNil ifTrue:[
+	    (oldList remove:aProcess ifAbsent:nil) notNil ifTrue:[
+		newList := quiescentProcessLists at:newPrio.
+		newList isNil ifTrue:[
+		    quiescentProcessLists at:newPrio put:(newList := LinkedList new).
+		].
+		newList addLast:aProcess.
+
+		"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.
+		    ]
+		].
+	    ]
+	]
     ] valueNowOrOnUnwindDo:[
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ]
 
     "Modified: 20.3.1997 / 16:02:00 / cg"
@@ -1443,10 +1442,10 @@
 
     s := thisContext sender.
     s selector == #threadSwitch: ifTrue:[
-        s := s sender.
-        s selector == #timerInterrupt ifTrue:[
-            s := s sender
-        ]
+	s := s sender.
+	s selector == #timerInterrupt ifTrue:[
+	    s := s sender
+	]
     ].
 
     activeProcess interruptedIn:s
@@ -1538,8 +1537,8 @@
      If the process is the current one, reschedule.
 
      Notice:
-         This method should only be called by Process>>suspend or
-         Process>>suspendWithState:"
+	 This method should only be called by Process>>suspend or
+	 Process>>suspendWithState:"
 
     |pri l p wasBlocked|
 
@@ -1547,26 +1546,26 @@
      some debugging stuff
     "
     aProcess isNil ifTrue:[
-        InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: nil suspend'.
-        ^ self
+	InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: nil suspend'.
+	^ self
     ].
     aProcess id isNil ifTrue:[
-        InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: bad suspend: already dead'.
-        self threadSwitch:scheduler.
-        ^ self
+	InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: bad suspend: already dead'.
+	self threadSwitch:scheduler.
+	^ self
     ].
     aProcess == scheduler ifTrue:[
-        "only scheduler may suspend itself"
-        activeProcess == scheduler ifTrue:[
-            suspendScheduler := true.
-            [suspendScheduler] whileTrue:[
-                self dispatch.
-            ].
-            ^ self
-        ].
-
-        InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: scheduler should never be suspended'.
-        ^ self
+	"only scheduler may suspend itself"
+	activeProcess == scheduler ifTrue:[
+	    suspendScheduler := true.
+	    [suspendScheduler] whileTrue:[
+		self dispatch.
+	    ].
+	    ^ self
+	].
+
+	InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: scheduler should never be suspended'.
+	^ self
     ].
 
     wasBlocked := OperatingSystem blockInterrupts.
@@ -1578,23 +1577,23 @@
      the ifAbsent block, because [] is a shared cheap block, created at compile time
     "
     (l isNil or:[(l remove:aProcess ifAbsent:[]) isNil]) ifTrue:[
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-        'Processor [warning]: bad suspend: not on run list' errorPrintCR.
-        "/ MiniDebugger enterWithMessage:'bad suspend: not on run list'.
-        self threadSwitch:scheduler.
-        ^ self
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	'Processor [warning]: bad suspend: not on run list' errorPrintCR.
+	"/ MiniDebugger enterWithMessage:'bad suspend: not on run list'.
+	self threadSwitch:scheduler.
+	^ self
     ].
 
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 
     (aProcess == activeProcess) ifTrue:[
-        "we can immediately switch sometimes"
-        l isEmpty ifFalse:[
-            p := l first
-        ] ifTrue:[
-            p := scheduler
-        ].
-        self threadSwitch:p 
+	"we can immediately switch sometimes"
+	l isEmpty ifFalse:[
+	    p := l first
+	] ifTrue:[
+	    p := scheduler
+	].
+	self threadSwitch:p 
     ].
 
     "Modified: 23.9.1996 / 13:49:24 / stefan"
@@ -1639,8 +1638,8 @@
 
     aProcess isNil ifTrue:[^ self].
     aProcess == scheduler ifTrue:[
-        InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: I will not terminate scheduler'.
-        ^ self
+	InvalidProcessSignal raiseWith:aProcess errorString:'PROCESSOR: I will not terminate scheduler'.
+	^ self
     ].
 
     id := aProcess id.
@@ -1655,23 +1654,23 @@
     pri := aProcess priority.
     l := quiescentProcessLists at:pri.
     (l remove:aProcess ifAbsent:nil) notNil ifTrue:[
-        l isEmpty ifTrue:[
-            quiescentProcessLists at:pri put:nil
-        ]
+	l isEmpty ifTrue:[
+	    quiescentProcessLists at:pri put:nil
+	]
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 
     aProcess == activeProcess ifTrue:[
-        "
-         hard case - its the currently running process
-         we must have the next active process destroy this one
-         (we cannot destroy the chair we are sitting on ... :-)
-        "
-        zombie := id.
-        self unRemember:aProcess.
-        self threadSwitch:scheduler.
-        "not reached"
-        ^ self
+	"
+	 hard case - its the currently running process
+	 we must have the next active process destroy this one
+	 (we cannot destroy the chair we are sitting on ... :-)
+	"
+	zombie := id.
+	self unRemember:aProcess.
+	self threadSwitch:scheduler.
+	"not reached"
+	^ self
     ].
     self class threadDestroy:id.
     self unRemember:aProcess.
@@ -1694,8 +1693,8 @@
      debugging consistency check - will be removed later
     "
     activeProcess priority ~~ currentPriority ifTrue:[
-        'Processor [warning]: process changed its priority' errorPrintCR.
-        currentPriority := activeProcess priority.
+	'Processor [warning]: process changed its priority' errorPrintCR.
+	currentPriority := activeProcess priority.
     ].
 
     l := quiescentProcessLists at:currentPriority.
@@ -1705,25 +1704,25 @@
      debugging consistency checks - will be removed later
     "
     sz == 0 ifTrue:[
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-        'Processor [warning]: empty runnable list' errorPrintCR.
-        ^ self
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	'Processor [warning]: empty runnable list' errorPrintCR.
+	^ self
     ].
 
     "
      check if the running process is not the only one
     "
     sz ~~ 1 ifTrue:[
-        "
-         bring running process to the end
-        "
-        l removeFirst.
-        l addLast:activeProcess.
-
-        "
-         and switch to first in the list
-        "
-        self threadSwitch:(l first).
+	"
+	 bring running process to the end
+	"
+	l removeFirst.
+	l addLast:activeProcess.
+
+	"
+	 and switch to first in the list
+	"
+	self threadSwitch:(l first).
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 
@@ -1754,22 +1753,22 @@
     timeSliceProcess notNil ifTrue: [^ self].
 
     timeSliceProcess := [
-        [
-            |myDelay t|
-
-            myDelay := Delay forMilliseconds:(t := TimeSliceInterval).
-
-            [true] whileTrue: [
-                t ~~ TimeSliceInterval ifTrue:[
-                    "/ interval changed -> need a new delay
-                    myDelay delay:(t := TimeSliceInterval).
-                ].
-                myDelay wait.
-                self slice
-            ]
-        ] valueOnUnwindDo:[
-            timeSliceProcess := nil
-        ]
+	[
+	    |myDelay t|
+
+	    myDelay := Delay forMilliseconds:(t := TimeSliceInterval).
+
+	    [true] whileTrue: [
+		t ~~ TimeSliceInterval ifTrue:[
+		    "/ interval changed -> need a new delay
+		    myDelay delay:(t := TimeSliceInterval).
+		].
+		myDelay wait.
+		self slice
+	    ]
+	] valueOnUnwindDo:[
+	    timeSliceProcess := nil
+	]
     ] newProcess.
     timeSliceProcess priority:HighestPriority.
     timeSliceProcess name:'time slicer'.
@@ -1789,7 +1788,7 @@
     "stop preemptive scheduling (timeSlicing)"
 
     timeSliceProcess notNil ifTrue: [
-        timeSliceProcess terminate.
+	timeSliceProcess terminate.
     ]
 
     "
@@ -1916,21 +1915,21 @@
      wasBlocked|
 
     aFileDescriptor isNil ifTrue:[
-        'ProcessorScheduler [info]: no fd to select on - polling with checkBlock' infoPrintCR
+	'ProcessorScheduler [info]: no fd to select on - polling with checkBlock' infoPrintCR
     ].
 
     wasBlocked := OperatingSystem blockInterrupts.
     (readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[
-        idx := readFdArray identityIndexOf:nil startingAt:1.
-        idx ~~ 0 ifTrue:[
-            readFdArray at:idx put:aFileDescriptor.
-            readSemaphoreArray at:idx put:aSemaphore.
-            readCheckArray at:idx put:aBlock
-        ] ifFalse:[
-            readFdArray := readFdArray copyWith:aFileDescriptor.
-            readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore.
-            readCheckArray := readCheckArray copyWith:aBlock.
-        ]
+	idx := readFdArray identityIndexOf:nil startingAt:1.
+	idx ~~ 0 ifTrue:[
+	    readFdArray at:idx put:aFileDescriptor.
+	    readSemaphoreArray at:idx put:aSemaphore.
+	    readCheckArray at:idx put:aBlock
+	] ifFalse:[
+	    readFdArray := readFdArray copyWith:aFileDescriptor.
+	    readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore.
+	    readCheckArray := readCheckArray copyWith:aBlock.
+	]
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 
@@ -2070,21 +2069,21 @@
     wasBlocked := OperatingSystem blockInterrupts.
     index := timeoutActionArray identityIndexOf:aBlock startingAt:1.
     index ~~ 0 ifTrue:[
-        timeoutArray at:index put:aMillisecondTime
+	timeoutArray at:index put:aMillisecondTime
     ] ifFalse:[
-        index := timeoutArray indexOf:nil.
-        index ~~ 0 ifTrue:[
-            timeoutArray at:index put:aMillisecondTime.
-            timeoutActionArray at:index put:aBlock.
-            timeoutSemaphoreArray at:index put:nil. 
-            timeoutProcessArray at:index put:aProcess 
-        ] ifFalse:[
-            timeoutArray := timeoutArray copyWith:aMillisecondTime.
-            timeoutActionArray := timeoutActionArray copyWith:aBlock.
-            timeoutSemaphoreArray := timeoutSemaphoreArray copyWith:nil.
-            timeoutProcessArray := timeoutProcessArray copyWith:aProcess.
-            index := timeoutArray size.
-        ].
+	index := timeoutArray indexOf:nil.
+	index ~~ 0 ifTrue:[
+	    timeoutArray at:index put:aMillisecondTime.
+	    timeoutActionArray at:index put:aBlock.
+	    timeoutSemaphoreArray at:index put:nil. 
+	    timeoutProcessArray at:index put:aProcess 
+	] ifFalse:[
+	    timeoutArray := timeoutArray copyWith:aMillisecondTime.
+	    timeoutActionArray := timeoutActionArray copyWith:aBlock.
+	    timeoutSemaphoreArray := timeoutSemaphoreArray copyWith:nil.
+	    timeoutProcessArray := timeoutProcessArray copyWith:aProcess.
+	    index := timeoutArray size.
+	].
     ].
 
     anyTimeouts := true.
@@ -2111,10 +2110,10 @@
     then := OperatingSystem millisecondTimeAdd:now and:delta.
 
     id := self
-        addTimeoutFunctionCall:anExternalFunction 
-        for:aProcess 
-        atMilliseconds:then 
-        with:argument.
+	addTimeoutFunctionCall:anExternalFunction 
+	for:aProcess 
+	atMilliseconds:then 
+	with:argument.
 
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ^ id
@@ -2137,9 +2136,9 @@
 
     action := [anExternalFunction callWith:argument].
     ^ self
-        addTimedBlock:action 
-        for:aProcess 
-        atMilliseconds:milliTime.
+	addTimedBlock:action 
+	for:aProcess 
+	atMilliseconds:milliTime.
 
     "Created: 23.9.1996 / 14:29:30 / cg"
     "Modified: 23.9.1996 / 14:34:57 / cg"
@@ -2231,14 +2230,14 @@
 
     index := anID.
     (index > 0) ifTrue:[
-        wasBlocked := OperatingSystem blockInterrupts.
-
-        timeoutArray at:index put:nil.
-        timeoutActionArray at:index put:nil. 
-        timeoutSemaphoreArray at:index put:nil.
-        timeoutProcessArray at:index put:nil.
-
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	wasBlocked := OperatingSystem blockInterrupts.
+
+	timeoutArray at:index put:nil.
+	timeoutActionArray at:index put:nil. 
+	timeoutSemaphoreArray at:index put:nil.
+	timeoutProcessArray at:index put:nil.
+
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ]
 
     "Created: 23.9.1996 / 14:32:33 / cg"
@@ -2328,43 +2327,43 @@
       readFdArray/writeFdArray in the debugger)"
 
     readFdArray keysAndValuesDo:[:idx :fd |
-        |rslt sema|
-
-        rslt := OperatingSystem
-                    selectOnAnyReadable:(Array with:fd)
-                               writable:nil
-                              exception:nil
-                            withTimeOut:0.
-
-        (rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]) ifTrue:[
-            ('Processor [info]: removing invalid read-select fileDescriptor: ' , fd printString) errorPrintCR.
-            readFdArray at:idx put:nil.
-            OperatingSystem clearLastErrorNumber.
-            (sema := readSemaphoreArray at:idx) notNil ifTrue:[
-                readSemaphoreArray at:idx put:nil.
-                sema signal.
-            ].
-        ]
+	|rslt sema|
+
+	rslt := OperatingSystem
+		    selectOnAnyReadable:(Array with:fd)
+			       writable:nil
+			      exception:nil
+			    withTimeOut:0.
+
+	(rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]) ifTrue:[
+	    ('Processor [info]: removing invalid read-select fileDescriptor: ' , fd printString) errorPrintCR.
+	    readFdArray at:idx put:nil.
+	    OperatingSystem clearLastErrorNumber.
+	    (sema := readSemaphoreArray at:idx) notNil ifTrue:[
+		readSemaphoreArray at:idx put:nil.
+		sema signal.
+	    ].
+	]
     ].
 
     writeFdArray keysAndValuesDo:[:idx :fd |
-        |rslt sema|
-
-        rslt := OperatingSystem
-                    selectOnAnyReadable:nil
-                               writable:(Array with:fd)
-                              exception:nil
-                            withTimeOut:0.
-
-        (rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]) ifTrue:[
-            ('Processor [info]: removing invalid write-select fileDescriptor: ' , fd printString) errorPrintCR.
-            writeFdArray at:idx put:nil.
-            OperatingSystem clearLastErrorNumber.
-            (sema := writeSemaphoreArray at:idx) notNil ifTrue:[
-                writeSemaphoreArray at:idx put:nil.
-                sema signal.
-            ].
-        ]
+	|rslt sema|
+
+	rslt := OperatingSystem
+		    selectOnAnyReadable:nil
+			       writable:(Array with:fd)
+			      exception:nil
+			    withTimeOut:0.
+
+	(rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]) ifTrue:[
+	    ('Processor [info]: removing invalid write-select fileDescriptor: ' , fd printString) errorPrintCR.
+	    writeFdArray at:idx put:nil.
+	    OperatingSystem clearLastErrorNumber.
+	    (sema := writeSemaphoreArray at:idx) notNil ifTrue:[
+		writeSemaphoreArray at:idx put:nil.
+		sema signal.
+	    ].
+	]
     ].
 
     "Modified: 12.4.1996 / 09:32:58 / stefan"
@@ -2516,6 +2515,6 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.125 1997-03-25 12:50:51 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.126 1997-04-11 09:35:42 cg Exp $'
 ! !
 ProcessorScheduler initialize!