diff -r ffad68df93ca -r f886d275e0fc ProcessorScheduler.st --- a/ProcessorScheduler.st Tue Aug 20 15:51:59 2013 +0200 +++ b/ProcessorScheduler.st Tue Aug 20 15:56:31 2013 +0200 @@ -1,6 +1,6 @@ " COPYRIGHT (c) 1993 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -12,24 +12,24 @@ "{ Package: 'stx:libbasic' }" Object subclass:#ProcessorScheduler - instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess - activeProcessId currentPriority readFdArray readSemaphoreArray - readCheckArray writeFdArray writeSemaphoreArray writeCheckArray - timeoutArray timeoutActionArray timeoutProcessArray - timeoutSemaphoreArray idleActions anyTimeouts dispatching - interruptedProcess useIOInterrupts gotIOInterrupt - osChildExitActions gotChildSignalInterrupt - exitWhenNoMoreUserProcesses suspendScheduler timeSliceProcess - supportDynamicPriorities timeSliceNeededSemaphore - scheduledProcesses preWaitActions timeoutHandlerProcess - readableResultFdArray writableResultFdArray' - classVariableNames:'KnownProcesses KnownProcessIds PureEventDriven - UserSchedulingPriority UserInterruptPriority TimingPriority - HighestPriority SchedulingPriority MaxNumberOfProcesses - InvalidProcessSignal TimeSlicingPriorityLimit TimeSliceInterval - EventPollingInterval' - poolDictionaries:'' - category:'Kernel-Processes' + instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess + activeProcessId currentPriority readFdArray readSemaphoreArray + readCheckArray writeFdArray writeSemaphoreArray writeCheckArray + timeoutArray timeoutActionArray timeoutProcessArray + timeoutSemaphoreArray idleActions anyTimeouts dispatching + interruptedProcess useIOInterrupts gotIOInterrupt + osChildExitActions gotChildSignalInterrupt + exitWhenNoMoreUserProcesses suspendScheduler timeSliceProcess + supportDynamicPriorities timeSliceNeededSemaphore + scheduledProcesses preWaitActions timeoutHandlerProcess + readableResultFdArray writableResultFdArray' + classVariableNames:'KnownProcesses KnownProcessIds PureEventDriven + UserSchedulingPriority UserInterruptPriority TimingPriority + HighestPriority SchedulingPriority MaxNumberOfProcesses + InvalidProcessSignal TimeSlicingPriorityLimit TimeSliceInterval + EventPollingInterval' + poolDictionaries:'' + category:'Kernel-Processes' ! !ProcessorScheduler class methodsFor:'documentation'! @@ -37,7 +37,7 @@ copyright " COPYRIGHT (c) 1993 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -77,102 +77,102 @@ (actually, it is no longer maintained, so dont run the system without Processes). [instance variables:] - quiescentProcessLists - list of waiting processes - scheduler - the scheduler process itself - zombie - internal temporary (recently died process) - activeProcess - the current process - activeProcessId - the current processes id - currentPriority - the current processes priority - readFdArray - fd-sema-checkBlock triple-association - readSemaphoreArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) - readCheckArray - writeFdArray - fd-sema-checkBlock triple-association - writeSemaphoreArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) - writeCheckArray - timeoutArray - time-action-process-sema quadruple-association - timeoutActionArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) - timeoutProcessArray - timeoutSemaphoreArray - idleActions - actions to be executed when idle - preWaitActions - actions to be executed BEFORE going into an OS-wait - anyTimeouts - flag if any timeouts are pending - dispatching - flag if dispatch process is running (i.e. NOT initializing) - interruptedProcess - the currently interrupted process. - useIOInterrupts - flag if the OS supports I/O interrupts and if they are used (to get me out of an OS wait) - gotIOInterrupt - flag if I came out of a wait due to an I/O interrupt - osChildExitActions - OS chid process actions - gotChildSignalInterrupt - flag if I came out of a wait due to an OS child interrupt - exitWhenNoMoreUserProcesses - flag which controls if ST/X should exit when the last process dies (for standalone apps) - suspendScheduler - internal use - timeSliceProcess - the timeSlicer process - supportDynamicPriorities - flag if dynamic priorities should be supported by the timeSlicer - scheduledProcesses - list of scheduled processes for the timeSlicers dynamic prio handling + quiescentProcessLists - list of waiting processes + scheduler - the scheduler process itself + zombie - internal temporary (recently died process) + activeProcess - the current process + activeProcessId - the current processes id + currentPriority - the current processes priority + readFdArray - fd-sema-checkBlock triple-association + readSemaphoreArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) + readCheckArray + writeFdArray - fd-sema-checkBlock triple-association + writeSemaphoreArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) + writeCheckArray + timeoutArray - time-action-process-sema quadruple-association + timeoutActionArray (stupid historic 3-separate arrays for hi-speed-optimization reasons) + timeoutProcessArray + timeoutSemaphoreArray + idleActions - actions to be executed when idle + preWaitActions - actions to be executed BEFORE going into an OS-wait + anyTimeouts - flag if any timeouts are pending + dispatching - flag if dispatch process is running (i.e. NOT initializing) + interruptedProcess - the currently interrupted process. + useIOInterrupts - flag if the OS supports I/O interrupts and if they are used (to get me out of an OS wait) + gotIOInterrupt - flag if I came out of a wait due to an I/O interrupt + osChildExitActions - OS chid process actions + gotChildSignalInterrupt - flag if I came out of a wait due to an OS child interrupt + exitWhenNoMoreUserProcesses - flag which controls if ST/X should exit when the last process dies (for standalone apps) + suspendScheduler - internal use + timeSliceProcess - the timeSlicer process + supportDynamicPriorities - flag if dynamic priorities should be supported by the timeSlicer + scheduledProcesses - list of scheduled processes for the timeSlicers dynamic prio handling [class variables:] - KnownProcesses all known processes - KnownProcessIds and their IDs - - PureEventDriven true, if no process support - is available - - UserSchedulingPriority the priority at which normal - user interfaces run - - UserInterruptPriority the priority at which user- - interrupts (Cntl-C) processing - takes place. Processes with - a greater or equal priority are - not interruptable. - - TimingPriority the priority used for timing. - Processes with a greater or - equal priority are not interrupted - by timers. - - HighestPriority The highest allowed prio for processes - - SchedulingPriority The priority of the scheduler (must - me higher than any other). - - MaxNumberOfProcesses if non-nil, no more than this - number of processes are allowed - (for debugging) - - TimeSliceInterval for preemptive priority scheduling only: - the time interval in millis, at which processes - are timesliced - - TimeSlicingPriorityLimit for preemptive priority scheduling only: - processes are only timesliced, if running - at or below this priority. - - EventPollingInterval for systems which do not support select on - a fileDescriptor: the polling interval in millis. + KnownProcesses all known processes + KnownProcessIds and their IDs + + PureEventDriven true, if no process support + is available + + UserSchedulingPriority the priority at which normal + user interfaces run + + UserInterruptPriority the priority at which user- + interrupts (Cntl-C) processing + takes place. Processes with + a greater or equal priority are + not interruptable. + + TimingPriority the priority used for timing. + Processes with a greater or + equal priority are not interrupted + by timers. + + HighestPriority The highest allowed prio for processes + + SchedulingPriority The priority of the scheduler (must + me higher than any other). + + MaxNumberOfProcesses if non-nil, no more than this + number of processes are allowed + (for debugging) + + TimeSliceInterval for preemptive priority scheduling only: + the time interval in millis, at which processes + are timesliced + + TimeSlicingPriorityLimit for preemptive priority scheduling only: + processes are only timesliced, if running + at or below this priority. + + EventPollingInterval for systems which do not support select on + a fileDescriptor: the polling interval in millis. most interesting methods: - Processor>>suspend: (see also Process>>suspend) - Processor>>resume: (see also Process>>resume) - Processor>>terminate: (see also Process>>terminate) - Processor>>yield - Processor>>changePriority:for: (see also Process>>priority: - - Processor>>signal:afterSeconds: (see also Delay>>forSeconds:) - Processor>>signal:afterMilliseconds: (see also Delay>>forMilliseconds:) - Processor>>signal:onInput: (see also ExternalStream>>readWait) - Processor>>signal:onOutput: (see also ExternalStream>>writeWait) - Processor>>disableSemaphore: + Processor>>suspend: (see also Process>>suspend) + Processor>>resume: (see also Process>>resume) + Processor>>terminate: (see also Process>>terminate) + Processor>>yield + Processor>>changePriority:for: (see also Process>>priority: + + Processor>>signal:afterSeconds: (see also Delay>>forSeconds:) + Processor>>signal:afterMilliseconds: (see also Delay>>forMilliseconds:) + Processor>>signal:onInput: (see also ExternalStream>>readWait) + Processor>>signal:onOutput: (see also ExternalStream>>writeWait) + Processor>>disableSemaphore: [see also:] - Process - Delay Semaphore SemaphoreSet SharedQueue - WindowGroup - (``Working with processes'': programming/processes.html) + Process + Delay Semaphore SemaphoreSet SharedQueue + WindowGroup + (``Working with processes'': programming/processes.html) [author:] - Claus Gittinger + Claus Gittinger " ! @@ -210,16 +210,16 @@ allows for critical processes to run unaffected to completion. WARNING: - timesliced priority scheduling is an experimental feature. There is no warranty, - (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 has being investigated for such possible trouble spots - (we have eliminated many weak spots, and added critical regions at many places, - but cannot guarantee that all of them have been found so far ...) - We found that many existing public domain programs are not prepared for - being interrupted by a same-prio process and therefore may corrupt their - data. If in doubt, disable this fefature. + timesliced priority scheduling is an experimental feature. There is no warranty, + (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 has being investigated for such possible trouble spots + (we have eliminated many weak spots, and added critical regions at many places, + but cannot guarantee that all of them have been found so far ...) + We found that many existing public domain programs are not prepared for + being interrupted by a same-prio process and therefore may corrupt their + data. If in doubt, disable this fefature. We think, that the timeSlicer is a useful add-on and that the system is fit enough for it to be evaluated, therefore, its included. @@ -227,10 +227,10 @@ To demonstrate the effect of timeSlicing, do the following: - - disable timeSlicing (in the launchers misc-settings menu) - - open a workSpace - - in the workspace, evaluate: - [true] whileTrue:[1000 factorial] + - disable timeSlicing (in the launchers misc-settings menu) + - open a workSpace + - in the workspace, evaluate: + [true] whileTrue:[1000 factorial] now, (since the workSpace runs at the same prio as other window-processes), other views do no longer react - all CPU is used up by the workSpace. @@ -260,15 +260,15 @@ SchedulingPriority := 31. InvalidProcessSignal isNil ifTrue:[ - InvalidProcessSignal := Error newSignalMayProceed:true. - InvalidProcessSignal nameClass:self message:#invalidProcessSignal. - InvalidProcessSignal notifierString:'invalid process'. + InvalidProcessSignal := Error 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. ]. " @@ -277,7 +277,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" @@ -311,22 +311,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" @@ -341,17 +341,17 @@ This may raise an exception, if a VM process could not be created." MaxNumberOfProcesses notNil ifTrue:[ - KnownProcessIds size >= MaxNumberOfProcesses ifTrue:[ - (KnownProcessIds count:[:el | el notNil]) >= MaxNumberOfProcesses ifTrue:[ - " - the number of processes has reached the (soft) limit. - This limit prevents runaway programs from creating too many - processes. If you continue in the debugger, the process will be - created as usual. If you dont want this, abort or terminate. - " - self error:'too many processes'. - ] - ] + KnownProcessIds size >= MaxNumberOfProcesses ifTrue:[ + (KnownProcessIds count:[:el | el notNil]) >= MaxNumberOfProcesses ifTrue:[ + " + the number of processes has reached the (soft) limit. + This limit prevents runaway programs from creating too many + processes. If you continue in the debugger, the process will be + created as usual. If you dont want this, abort or terminate. + " + self error:'too many processes'. + ] + ] ]. %{ @@ -359,11 +359,11 @@ extern int __threadCreate(); tid = __threadCreate(aProcess, - 0 /* stackSize: no longer needed */, - __isSmallInteger(id) ? __intVal(id) /* assign id */ - : -1 /* let VM assign one */ ); + 0 /* stackSize: no longer needed */, + __isSmallInteger(id) ? __intVal(id) /* assign id */ + : -1 /* let VM assign one */ ); if (tid) { - RETURN ( __mkSmallInteger(tid)); + RETURN ( __mkSmallInteger(tid)); } %} . @@ -383,7 +383,7 @@ %{ /* NOCONTEXT */ if (__isSmallInteger(id)) { - __threadDestroy(__intVal(id)); + __threadDestroy(__intVal(id)); } %} ! @@ -397,7 +397,7 @@ %{ /* NOCONTEXT */ if (__isSmallInteger(id)) { - __threadInterrupt(__intVal(id)); + __threadInterrupt(__intVal(id)); } %} ! @@ -439,7 +439,7 @@ "evaluate aBlock for each (living) processes in the system" KnownProcesses do:[:p | - (p notNil and:[p ~~ 0]) ifTrue:[aBlock value:p] + (p notNil and:[p ~~ 0]) ifTrue:[aBlock value:p] ] "Created: / 26-10-2012 / 13:02:33 / cg" @@ -485,20 +485,20 @@ wasBlocked := OperatingSystem blockInterrupts. useIOInterrupts ifTrue:[ - OperatingSystem disableIOInterruptsOn:aFileDescriptor + OperatingSystem disableIOInterruptsOn:aFileDescriptor ]. idx := readFdArray identityIndexOf:aFileDescriptor startingAt:1. idx ~~ 0 ifTrue:[ - readFdArray at:idx put:nil. - readCheckArray at:idx put:nil. - readSemaphoreArray at:idx put:nil + readFdArray at:idx put:nil. + readCheckArray at:idx put:nil. + readSemaphoreArray at:idx put:nil ]. idx := writeFdArray identityIndexOf:aFileDescriptor startingAt:1. idx ~~ 0 ifTrue:[ - writeFdArray at:idx put:nil. - writeCheckArray at:idx put:nil. - writeSemaphoreArray at:idx put:nil + writeFdArray at:idx put:nil. + writeCheckArray at:idx put:nil. + writeSemaphoreArray at:idx put:nil ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -514,26 +514,26 @@ wasBlocked| aFileDescriptor < 0 ifTrue:[ - 'Processor [warning]: ignored invalid fd for IO action.' errorPrintCR. - thisContext fullPrintAll. - ^ self + 'Processor [warning]: ignored invalid fd for IO action.' errorPrintCR. + thisContext fullPrintAll. + ^ self ]. wasBlocked := OperatingSystem blockInterrupts. (readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[ - idx := readFdArray identityIndexOf:nil startingAt:1. - idx ~~ 0 ifTrue:[ - readFdArray at:idx put:aFileDescriptor. - readCheckArray at:idx put:aBlock. - readSemaphoreArray at:idx put:nil - ] ifFalse:[ - readFdArray := readFdArray copyWith:aFileDescriptor. - readCheckArray := readCheckArray copyWith:aBlock. - readSemaphoreArray := readSemaphoreArray copyWith:nil. - ]. - useIOInterrupts ifTrue:[ - OperatingSystem enableIOInterruptsOn:aFileDescriptor - ]. + idx := readFdArray identityIndexOf:nil startingAt:1. + idx ~~ 0 ifTrue:[ + readFdArray at:idx put:aFileDescriptor. + readCheckArray at:idx put:aBlock. + readSemaphoreArray at:idx put:nil + ] ifFalse:[ + readFdArray := readFdArray copyWith:aFileDescriptor. + readCheckArray := readCheckArray copyWith:aBlock. + readSemaphoreArray := readSemaphoreArray copyWith:nil. + ]. + useIOInterrupts ifTrue:[ + OperatingSystem enableIOInterruptsOn:aFileDescriptor + ]. ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -602,7 +602,7 @@ wasBlocked := OperatingSystem blockInterrupts. idleActions isNil ifTrue:[ - idleActions := OrderedCollection new + idleActions := OrderedCollection new ]. idleActions add:aBlock. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -874,9 +874,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. ]. " @@ -899,7 +899,7 @@ anyTimeouts := false. dispatching := false. exitWhenNoMoreUserProcesses isNil ifTrue:[ - exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ? + exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ? ]. useIOInterrupts := OperatingSystem supportsIOInterrupts. gotIOInterrupt := false. @@ -956,16 +956,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. @@ -976,7 +976,7 @@ self initialize. processesToRestart do:[:p | - p imageRestart + p imageRestart ] "Modified: / 7.6.1998 / 02:23:56 / cg" @@ -994,44 +994,44 @@ |index pri aProcess l| OperatingSystem interruptsBlocked ifFalse:[ - MiniDebugger - enterWithMessage:'vmResumeInterrupt with no interruptsBlocked' - mayProceed:true. + MiniDebugger + enterWithMessage:'vmResumeInterrupt with no interruptsBlocked' + mayProceed:true. ]. index := KnownProcessIds identityIndexOf:id. index ~~ 0 ifTrue:[ - aProcess := KnownProcesses at:index. - pri := aProcess priority. - l := quiescentProcessLists at:pri. - l notNil ifTrue:[ - (l includesIdentical:aProcess) ifTrue:[ - "/ aProcess is on a run queue. - "/ CG: this situation may happen, if the wrapCall - "/ finishes before the process was layed to sleep - "/ (i.e. schedulerIRQ arrives before the threadSwitch was finished). - "/ In that case, simply resume it and everything is OK. - "/ If the process is state running, ignore. - - |state| - - state := aProcess state. - (state == #wrapWait or:[state == #osWait] or:[state == #stopped]) ifTrue:[ - aProcess state:#run. - ]. - 'ProcSched [info]: resumeIRQ ignored for process: ' infoPrint. - aProcess id infoPrint. ' in state: ' infoPrint. state infoPrintCR. - ^ self - ] - ] ifFalse:[ - l := LinkedList new. - quiescentProcessLists at:pri put:l. - ]. - l addLast:aProcess. - aProcess state:#run. + aProcess := KnownProcesses at:index. + pri := aProcess priority. + l := quiescentProcessLists at:pri. + l notNil ifTrue:[ + (l includesIdentical:aProcess) ifTrue:[ + "/ aProcess is on a run queue. + "/ CG: this situation may happen, if the wrapCall + "/ finishes before the process was layed to sleep + "/ (i.e. schedulerIRQ arrives before the threadSwitch was finished). + "/ In that case, simply resume it and everything is OK. + "/ If the process is state running, ignore. + + |state| + + state := aProcess state. + (state == #wrapWait or:[state == #osWait] or:[state == #stopped]) ifTrue:[ + aProcess state:#run. + ]. + 'ProcSched [info]: resumeIRQ ignored for process: ' infoPrint. + aProcess id infoPrint. ' in state: ' infoPrint. state infoPrintCR. + ^ self + ] + ] ifFalse:[ + l := LinkedList new. + quiescentProcessLists at:pri put:l. + ]. + l addLast:aProcess. + aProcess state:#run. ] ifFalse:[ - 'ProcSched [info]: resumeIRQ for unknown process: ' infoPrint. - id infoPrintCR. + 'ProcSched [info]: resumeIRQ for unknown process: ' infoPrint. + id infoPrintCR. ] "Modified: / 28.9.1998 / 11:36:53 / cg" @@ -1048,19 +1048,19 @@ |pri l newState| OperatingSystem interruptsBlocked ifFalse:[ - MiniDebugger - enterWithMessage:'immediateInterrupt with no interruptsBlocked' - mayProceed:true. + MiniDebugger + enterWithMessage:'immediateInterrupt with no interruptsBlocked' + mayProceed:true. ]. (whyCode == 2) ifTrue:[ - newState := #wrapWait. + newState := #wrapWait. ] ifFalse:[ - (whyCode == 3) ifTrue:[ - newState := #osWait. - ] ifFalse:[ - newState := #stopped. - ]. + (whyCode == 3) ifTrue:[ + newState := #osWait. + ] ifFalse:[ + newState := #stopped. + ]. ]. activeProcess setStateTo:newState if:#active. @@ -1071,9 +1071,9 @@ the ifAbsent block, because [] is a shared cheap block, created at compile time " (l isNil or:[(l removeIdentical:activeProcess ifAbsent:nil) isNil]) ifTrue:[ - "/ 'Processor [warning]: bad vmSuspendInterrupt: not on run list' errorPrintCR. - MiniDebugger enterWithMessage:'bad vmSuspendInterrupt: not on run list' mayProceed:true. - ^ self + "/ 'Processor [warning]: bad vmSuspendInterrupt: not on run list' errorPrintCR. + MiniDebugger enterWithMessage:'bad vmSuspendInterrupt: not on run list' mayProceed:true. + ^ self ]. ! ! @@ -1087,8 +1087,8 @@ gotChildSignalInterrupt := true. activeProcess ~~ scheduler ifTrue:[ - interruptedProcess := activeProcess. - self threadSwitch:scheduler + interruptedProcess := activeProcess. + self threadSwitch:scheduler ] "Modified: 12.4.1996 / 10:12:18 / stefan" @@ -1105,37 +1105,37 @@ "/ no interrupt processing, to avoid races with monitorPid wasBlocked := OperatingSystem blockInterrupts. [ - [ - osProcessStatus := OperatingSystem childProcessWait:blocking pid:nil. - osProcessStatus notNil ifTrue:[ - |pid action| - - pid := osProcessStatus pid. - osProcessStatus stillAlive ifTrue:[ - action := osChildExitActions at:pid ifAbsent:nil. - ] ifFalse:[ - action := osChildExitActions removeKey:pid ifAbsent:nil. - ]. - action notNil ifTrue:[ - action value:osProcessStatus - ]. - ]. - - "/ if pollChildProcesses does block, poll only one status change. - "/ we will get another SIGCHLD for other status changes. - - 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. - - osChildExitActions isEmpty ifTrue:[ - OperatingSystem disableChildSignalInterrupts. - ]. + [ + osProcessStatus := OperatingSystem childProcessWait:blocking pid:nil. + osProcessStatus notNil ifTrue:[ + |pid action| + + pid := osProcessStatus pid. + osProcessStatus stillAlive ifTrue:[ + action := osChildExitActions at:pid ifAbsent:nil. + ] ifFalse:[ + action := osChildExitActions removeKey:pid ifAbsent:nil. + ]. + action notNil ifTrue:[ + action value:osProcessStatus + ]. + ]. + + "/ if pollChildProcesses does block, poll only one status change. + "/ we will get another SIGCHLD for other status changes. + + 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. + + osChildExitActions isEmpty ifTrue:[ + OperatingSystem disableChildSignalInterrupts. + ]. ] ensure:[ - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ] "Modified: 5.1.1996 / 16:56:11 / stefan" @@ -1156,67 +1156,67 @@ |pid wasBlocked osProcessStatus| OperatingSystem supportsChildInterrupts ifTrue:[ - "/ SIGCHLD is supported, - "/ aBlock will be evaluated, as soon as a SIGCHLD interrupt for pid has been received. - - OperatingSystem enableChildSignalInterrupts. - wasBlocked := OperatingSystem blockInterrupts. - pid := aBlockReturningPid value. - pid notNil ifTrue:[ - osChildExitActions at:pid put:actionBlock. - ]. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + "/ SIGCHLD is supported, + "/ aBlock will be evaluated, as soon as a SIGCHLD interrupt for pid has been received. + + OperatingSystem enableChildSignalInterrupts. + wasBlocked := OperatingSystem blockInterrupts. + pid := aBlockReturningPid value. + pid notNil ifTrue:[ + osChildExitActions at:pid put:actionBlock. + ]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ] ifFalse:[ - "/ SIGCHLD is not supported, fork a high prio process - "/ to poll for for the exit of pid. - - wasBlocked := OperatingSystem blockInterrupts. - pid := aBlockReturningPid value. - pid notNil ifTrue:[ - osChildExitActions at:pid put:actionBlock. - ]. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - - pid notNil ifTrue:[ - [ - [ - |polling myDelay t| - - polling := true. - myDelay := Delay forMilliseconds:(t := EventPollingInterval). - [polling] whileTrue:[ - t ~~ EventPollingInterval ifTrue:[ - "/ interval changed -> need a new delay - myDelay delay:(t := EventPollingInterval). - ]. - myDelay wait. - (osChildExitActions includesKey:pid) ifFalse:[ - polling := false. - ] ifTrue:[ - osProcessStatus := OperatingSystem childProcessWait:false pid:pid. - osProcessStatus notNil ifTrue:[ - (osProcessStatus pid = pid) ifTrue:[ - OperatingSystem blockInterrupts. - osChildExitActions removeKey:pid ifAbsent:nil. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - actionBlock value:osProcessStatus. - polling := false. - ] ifFalse:[ - osProcessStatus stillAlive - ] - ] - ]. - ] - ] ifCurtailed:[ - OperatingSystem blockInterrupts. - osChildExitActions removeKey:pid ifAbsent:nil. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ] - ] newProcess - priority:TimingPriority; + "/ SIGCHLD is not supported, fork a high prio process + "/ to poll for for the exit of pid. + + wasBlocked := OperatingSystem blockInterrupts. + pid := aBlockReturningPid value. + pid notNil ifTrue:[ + osChildExitActions at:pid put:actionBlock. + ]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + + pid notNil ifTrue:[ + [ + [ + |polling myDelay t| + + polling := true. + myDelay := Delay forMilliseconds:(t := EventPollingInterval). + [polling] whileTrue:[ + t ~~ EventPollingInterval ifTrue:[ + "/ interval changed -> need a new delay + myDelay delay:(t := EventPollingInterval). + ]. + myDelay wait. + (osChildExitActions includesKey:pid) ifFalse:[ + polling := false. + ] ifTrue:[ + osProcessStatus := OperatingSystem childProcessWait:false pid:pid. + osProcessStatus notNil ifTrue:[ + (osProcessStatus pid = pid) ifTrue:[ + OperatingSystem blockInterrupts. + osChildExitActions removeKey:pid ifAbsent:nil. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + actionBlock value:osProcessStatus. + polling := false. + ] ifFalse:[ + osProcessStatus stillAlive + ] + ] + ]. + ] + ] ifCurtailed:[ + OperatingSystem blockInterrupts. + osChildExitActions removeKey:pid ifAbsent:nil. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ] + ] newProcess + priority:TimingPriority; "/ beSystemProcess; - resume. - ]. + resume. + ]. ]. ^ pid @@ -1241,10 +1241,10 @@ self scheduleInterruptActionsOf:aProcess. aProcess state ~~ #stopped ifTrue:[ - " - make the process runnable - " - self resume:aProcess + " + make the process runnable + " + self resume:aProcess ] "Modified: / 24.8.1998 / 18:31:32 / cg" @@ -1298,9 +1298,9 @@ extern OBJ ___threadSwitch(); if (__isSmallInteger(id)) { - ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0, 0); + ok = ___threadSwitch(__context, __intVal(id), (singleStep == true) ? 1 : 0, 0); } else { - ok = false; + ok = false; } %}. @@ -1313,40 +1313,40 @@ currentPriority := oldProcess priority. ok == true ifFalse:[ - " - switch failed for some reason - - destroy (hard-terminate) the bad process. - This happens when: - - the stack went above the absolute limit - (VM switches back to scheduler) - - a halted process cannot execute its interrupt - actions (win32 only) - " - (id := p id) ~~ 0 ifTrue:[ - id notNil ifTrue:[ - 'Processor [warning]: problem with process ' errorPrint. - id errorPrint. - (nm := p name) notNil ifTrue:[ - ' (' errorPrint. nm errorPrint. ')' errorPrint. - ]. - - ok == #halted ifTrue:[ - "/ that process was halted (win32 only) - p state:#halted. - '; stopped it.' errorPrintCR. - self suspend:p. - ] ifFalse:[ - '; hard-terminate it.' errorPrintCR. - 'Processor [info]: cleanup may take a while if stack is huge' infoPrintCR. - p state:#cleanup. - self terminateNoSignal:p. - ] - ] - ] + " + switch failed for some reason - + destroy (hard-terminate) the bad process. + This happens when: + - the stack went above the absolute limit + (VM switches back to scheduler) + - a halted process cannot execute its interrupt + actions (win32 only) + " + (id := p id) ~~ 0 ifTrue:[ + id notNil ifTrue:[ + 'Processor [warning]: problem with process ' errorPrint. + id errorPrint. + (nm := p name) notNil ifTrue:[ + ' (' errorPrint. nm errorPrint. ')' errorPrint. + ]. + + ok == #halted ifTrue:[ + "/ that process was halted (win32 only) + p state:#halted. + '; stopped it.' errorPrintCR. + self suspend:p. + ] ifFalse:[ + '; hard-terminate it.' errorPrintCR. + 'Processor [info]: cleanup may take a while if stack is huge' infoPrintCR. + p state:#cleanup. + self terminateNoSignal:p. + ] + ] + ] ]. zombie notNil ifTrue:[ - self class threadDestroy:zombie. - zombie := nil + self class threadDestroy:zombie. + zombie := nil ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -1460,17 +1460,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. @@ -1478,10 +1478,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]. @@ -1497,8 +1497,8 @@ wasBlocked := OperatingSystem blockInterrupts. index := KnownProcesses identityIndexOf:aProcess. index ~~ 0 ifTrue:[ - KnownProcessIds at:index put:nil. - KnownProcesses at:index put:nil. + KnownProcessIds at:index put:nil. + KnownProcesses at:index put:nil. ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ! ! @@ -1523,12 +1523,12 @@ "private entry for Process restart - do not use in your program" idWant isNil ifTrue:[ - self newProcessFor:aProcess. - ^ true. + self newProcessFor:aProcess. + ^ true. ]. (self class threadCreate:aProcess withId:idWant) ~~ idWant ifTrue:[ - ^ false + ^ false ]. aProcess state:#light. "meaning: has no stack yet" @@ -1569,16 +1569,16 @@ listArray := quiescentProcessLists. [prio >= 1] whileTrue:[ - l := listArray at:prio. - l notNil ifTrue:[ - l do:[:aProcess | - aProcess processGroupId ~~ 0 ifTrue:[ - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ true. - ] - ] - ]. - prio := prio - 1 + l := listArray at:prio. + l notNil ifTrue:[ + l do:[:aProcess | + aProcess processGroupId ~~ 0 ifTrue:[ + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ true. + ] + ] + ]. + prio := prio - 1 ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ^ false @@ -1608,8 +1608,8 @@ " if it got corrupted somehow ... " - p id isNil ifTrue:[ - 'Processor [warning]: process with nil id removed' errorPrintCR. + p isDead ifTrue:[ + 'Processor [warning]: dead process removed' errorPrintCR. l removeFirst. p := nil. ]. @@ -1674,48 +1674,48 @@ " 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 removeIdentical: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. - ] - ]. - timeSliceNeededSemaphore notNil ifTrue:[ - "/ tell timeslicer, that some work might be needed... - timeSliceNeededSemaphore signalIf. - ] - ] - ] + wasBlocked := OperatingSystem blockInterrupts. + + aProcess setPriority:newPrio. + + oldList := quiescentProcessLists at:oldPrio. + oldList notNil ifTrue:[ + (oldList removeIdentical: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. + ] + ]. + timeSliceNeededSemaphore notNil ifTrue:[ + "/ tell timeslicer, that some work might be needed... + timeSliceNeededSemaphore signalIf. + ] + ] + ] ] ensure:[ - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ] "Modified: / 4.8.1998 / 00:08:54 / cg" @@ -1737,13 +1737,13 @@ s := thisContext sender. s selector == #threadSwitchFrom:to:id:singleStep: ifTrue:[ - s := s sender. - s selector == #threadSwitch: ifTrue:[ - s := s sender. - s selector == #timerInterrupt ifTrue:[ - s := s sender - ] - ] + s := s sender. + s selector == #threadSwitch: ifTrue:[ + s := s sender. + s selector == #timerInterrupt ifTrue:[ + s := s sender + ] + ] ]. "/ the returned value here has a subtle effect: @@ -1840,8 +1840,8 @@ if its prio is higher than the currently running prio, switch to it." (self makeRunnable:aProcess) ifTrue:[ - "aProcess prio is higher; immediately transfer control to it" - self threadSwitch:aProcess. + "aProcess prio is higher; immediately transfer control to it" + self threadSwitch:aProcess. ]. ! @@ -1861,8 +1861,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| @@ -1870,30 +1870,30 @@ some debugging stuff " aProcess isNil ifTrue:[ - InvalidProcessSignal raiseRequestWith:aProcess errorString:'nil suspend'. - ^ self + InvalidProcessSignal raiseRequestWith:aProcess errorString:'nil suspend'. + ^ self ]. - aProcess id isNil ifTrue:[ - InvalidProcessSignal raiseRequestWith:aProcess errorString:'bad suspend: already dead'. - self threadSwitch:scheduler. - ^ self + aProcess isDead ifTrue:[ + InvalidProcessSignal raiseRequestWith:aProcess errorString:'bad suspend: already dead'. + self threadSwitch:scheduler. + ^ self ]. aProcess == scheduler ifTrue:[ - "only the scheduler may suspend itself" - activeProcess == scheduler ifTrue:[ - suspendScheduler := true. - [suspendScheduler] whileTrue:[ - self dispatch. - ]. - ^ self - ]. - - InvalidProcessSignal raiseRequestWith:aProcess errorString:'attempt to suspend scheduler'. - ^ self + "only the scheduler may suspend itself" + activeProcess == scheduler ifTrue:[ + suspendScheduler := true. + [suspendScheduler] whileTrue:[ + self dispatch. + ]. + ^ self + ]. + + InvalidProcessSignal raiseRequestWith:aProcess errorString:'attempt to suspend scheduler'. + ^ self ]. aProcess hasInterruptActions ifTrue:[ - aProcess interrupt. + aProcess interrupt. ]. wasBlocked := OperatingSystem blockInterrupts. @@ -1905,23 +1905,23 @@ the ifAbsent block, because [] is a shared cheap block, created at compile time " (l isNil or:[(l removeIdentical:aProcess ifAbsent:nil) isNil]) ifTrue:[ - "/ 'Processor [warning]: bad suspend: process is not running' errorPrintCR. - "/ MiniDebugger enterWithMessage:'bad suspend: process is not running'. - aProcess == activeProcess ifTrue:[ - self threadSwitch:scheduler. - ]. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ self + "/ 'Processor [warning]: bad suspend: process is not running' errorPrintCR. + "/ MiniDebugger enterWithMessage:'bad suspend: process is not running'. + aProcess == activeProcess ifTrue:[ + self threadSwitch:scheduler. + ]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ self ]. (aProcess == activeProcess) ifTrue:[ - "we can immediately switch sometimes" - l isEmpty ifTrue:[ - p := scheduler - ] ifFalse:[ - p := l first - ]. - self threadSwitch:p + "we can immediately switch sometimes" + l isEmpty ifTrue:[ + p := scheduler + ] ifFalse:[ + p := l first + ]. + self threadSwitch:p ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -1968,16 +1968,16 @@ aProcess isNil ifTrue:[^ self]. aProcess == scheduler ifTrue:[ - InvalidProcessSignal raiseWith:aProcess errorString:'attempt to terminate scheduler'. - ^ self + InvalidProcessSignal raiseWith:aProcess errorString:'attempt to terminate scheduler'. + ^ self ]. wasBlocked := OperatingSystem blockInterrupts. id := aProcess id. id isNil ifTrue:[ "already dead" - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ self + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ self ]. aProcess setId:nil state:#dead. @@ -1987,31 +1987,31 @@ pri := aProcess priority. l := quiescentProcessLists at:pri. l notNil ifTrue:[ - (l removeIdentical:aProcess ifAbsent:nil) "notNil ifTrue:[ - l isEmpty ifTrue:[ - quiescentProcessLists at:pri put:nil - ] - ]." + (l removeIdentical:aProcess ifAbsent:nil) "notNil ifTrue:[ + l isEmpty ifTrue:[ + quiescentProcessLists at:pri put:nil + ] + ]." ]. aProcess == activeProcess ifTrue:[ - " - hard case - it's the currently running process - we must have the next active process destroy this one - (we cannot destroy the chair we are sitting on ... :-) - " - zombie notNil ifTrue:[ - self error:'active process is zombie' mayProceed:true. - self class threadDestroy:zombie. - ]. - - self unRemember:aProcess. - zombie := id. - - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - self threadSwitch:scheduler. - "not reached" - ^ self + " + hard case - it's the currently running process + we must have the next active process destroy this one + (we cannot destroy the chair we are sitting on ... :-) + " + zombie notNil ifTrue:[ + self error:'active process is zombie' mayProceed:true. + self class threadDestroy:zombie. + ]. + + self unRemember:aProcess. + zombie := id. + + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + self threadSwitch:scheduler. + "not reached" + ^ self ]. self unRemember:aProcess. @@ -2034,16 +2034,16 @@ wasBlocked := OperatingSystem blockInterrupts. activeProcess == scheduler ifTrue:[ - 'Processor [warning]: scheduler tries to yield' errorPrintCR. - ^ self + 'Processor [warning]: scheduler tries to yield' errorPrintCR. + ^ self ]. " 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. @@ -2053,25 +2053,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]. @@ -2171,14 +2171,14 @@ i := TimeSlicingPriorityLimit. [(i > 0) and:[(list := quiescentProcessLists at:i) size <= 1]] whileTrue: [i := i - 1]. i ~~ 0 ifTrue: [ - "/ shuffle that list - list addLast:(list removeFirst). - anyShuffle := true. + "/ shuffle that list + list addLast:(list removeFirst). + anyShuffle := true. ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. anyShuffle ifFalse:[ - "/ wait for the scheduler to make some process runnable... - timeSliceNeededSemaphore wait. + "/ wait for the scheduler to make some process runnable... + timeSliceNeededSemaphore wait. ]. "Modified: / 4.8.1998 / 00:13:32 / cg" @@ -2192,37 +2192,37 @@ timeSliceNeededSemaphore := Semaphore new name:'timeSlice needed'. timeSliceProcess := [ - [ - |myDelay t flipFlop| - - myDelay := Delay forMilliseconds:(t := TimeSliceInterval). - flipFlop := true. - - 'Processor [info]: timeslicer started' infoPrintCR. - [true] whileTrue: [ - t ~~ TimeSliceInterval ifTrue:[ - "/ interval changed -> need a new delay - myDelay delay:(t := TimeSliceInterval). - ]. - myDelay wait. - self slice. - - "/ every other tick, recompute priorities. - flipFlop := flipFlop not. - flipFlop ifTrue:[ - scheduledProcesses notNil ifTrue:[ - supportDynamicPriorities == true ifTrue:[ - self recomputeDynamicPriorities. - ]. - scheduledProcesses removeAll. - ]. - scheduledProcesses := IdentitySet new. - ]. - ] - ] ifCurtailed:[ - timeSliceProcess := nil. - 'Processor [info]: timeslicer finished' infoPrintCR. - ] + [ + |myDelay t flipFlop| + + myDelay := Delay forMilliseconds:(t := TimeSliceInterval). + flipFlop := true. + + 'Processor [info]: timeslicer started' infoPrintCR. + [true] whileTrue: [ + t ~~ TimeSliceInterval ifTrue:[ + "/ interval changed -> need a new delay + myDelay delay:(t := TimeSliceInterval). + ]. + myDelay wait. + self slice. + + "/ every other tick, recompute priorities. + flipFlop := flipFlop not. + flipFlop ifTrue:[ + scheduledProcesses notNil ifTrue:[ + supportDynamicPriorities == true ifTrue:[ + self recomputeDynamicPriorities. + ]. + scheduledProcesses removeAll. + ]. + scheduledProcesses := IdentitySet new. + ]. + ] + ] ifCurtailed:[ + timeSliceProcess := nil. + 'Processor [info]: timeslicer finished' infoPrintCR. + ] ] newProcess. timeSliceProcess priority:HighestPriority. timeSliceProcess name:'time slicer'. @@ -2243,10 +2243,10 @@ "stop preemptive scheduling (timeSlicing)" timeSliceProcess notNil ifTrue: [ - timeSliceProcess terminate. - timeSliceProcess := nil. - scheduledProcesses := nil. - timeSliceNeededSemaphore := nil. + timeSliceProcess terminate. + timeSliceProcess := nil. + scheduledProcesses := nil. + timeSliceNeededSemaphore := nil. ] " @@ -2290,37 +2290,37 @@ wasBlocked := OperatingSystem blockInterrupts. idx := readSemaphoreArray identityIndexOf:aSemaphore startingAt:1. [idx ~~ 0] whileTrue:[ - useIOInterrupts ifTrue:[ - fd := readFdArray at:idx. - fd notNil ifTrue:[ - OperatingSystem disableIOInterruptsOn:fd - ]. - ]. - readFdArray at:idx put:nil. - readSemaphoreArray at:idx put:nil. - readCheckArray at:idx put:nil. - idx := readSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. + useIOInterrupts ifTrue:[ + fd := readFdArray at:idx. + fd notNil ifTrue:[ + OperatingSystem disableIOInterruptsOn:fd + ]. + ]. + readFdArray at:idx put:nil. + readSemaphoreArray at:idx put:nil. + readCheckArray at:idx put:nil. + idx := readSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. ]. idx := writeSemaphoreArray identityIndexOf:aSemaphore startingAt:1. [idx ~~ 0] whileTrue:[ - useIOInterrupts ifTrue:[ - fd := writeFdArray at:idx. - fd notNil ifTrue:[ - OperatingSystem disableIOInterruptsOn:fd - ]. - ]. - writeFdArray at:idx put:nil. - writeSemaphoreArray at:idx put:nil. - writeCheckArray at:idx put:nil. - idx := writeSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. + useIOInterrupts ifTrue:[ + fd := writeFdArray at:idx. + fd notNil ifTrue:[ + OperatingSystem disableIOInterruptsOn:fd + ]. + ]. + writeFdArray at:idx put:nil. + writeSemaphoreArray at:idx put:nil. + writeCheckArray at:idx put:nil. + idx := writeSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. ]. idx := timeoutSemaphoreArray identityIndexOf:aSemaphore startingAt:1. [idx ~~ 0] whileTrue:[ - timeoutArray at:idx put:nil. - timeoutSemaphoreArray at:idx put:nil. - timeoutActionArray at:idx put:nil. - timeoutProcessArray at:idx put:nil. - idx := timeoutSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. + timeoutArray at:idx put:nil. + timeoutSemaphoreArray at:idx put:nil. + timeoutActionArray at:idx put:nil. + timeoutProcessArray at:idx put:nil. + idx := timeoutSemaphoreArray identityIndexOf:aSemaphore startingAt:idx+1. ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -2373,20 +2373,20 @@ wasBlocked := OperatingSystem blockInterrupts. index := timeoutSemaphoreArray identityIndexOf:aSemaphore startingAt:1. index ~~ 0 ifTrue:[ - timeoutArray at:index put:aMillisecondTime + timeoutArray at:index put:aMillisecondTime ] ifFalse:[ - index := timeoutArray identityIndexOf:nil startingAt:1. - index ~~ 0 ifTrue:[ - timeoutSemaphoreArray at:index put:aSemaphore. - timeoutArray at:index put:aMillisecondTime. - timeoutActionArray at:index put:nil. - timeoutProcessArray at:index put:nil - ] ifFalse:[ - timeoutSemaphoreArray := timeoutSemaphoreArray copyWith:aSemaphore. - timeoutArray := timeoutArray copyWith:aMillisecondTime. - timeoutActionArray := timeoutActionArray copyWith:nil. - timeoutProcessArray := timeoutProcessArray copyWith:nil - ]. + index := timeoutArray identityIndexOf:nil startingAt:1. + index ~~ 0 ifTrue:[ + timeoutSemaphoreArray at:index put:aSemaphore. + timeoutArray at:index put:aMillisecondTime. + timeoutActionArray at:index put:nil. + timeoutProcessArray at:index put:nil + ] ifFalse:[ + timeoutSemaphoreArray := timeoutSemaphoreArray copyWith:aSemaphore. + timeoutArray := timeoutArray copyWith:aMillisecondTime. + timeoutActionArray := timeoutActionArray copyWith:nil. + timeoutProcessArray := timeoutProcessArray copyWith:nil + ]. ]. anyTimeouts := true. @@ -2471,11 +2471,11 @@ otherwise, it will be polled every few milliseconds (MSDOS)." aStream canBeSelected ifTrue:[ - "/ can this stream be selected on ? - self signal:aSemaphore onInput:aStream fileDescriptor orCheck:nil + "/ can this stream be selected on ? + self signal:aSemaphore onInput:aStream fileDescriptor orCheck:nil ] ifFalse:[ - "/ nope - must poll ... - self signal:aSemaphore onInput:nil orCheck:[aStream canReadWithoutBlocking] + "/ nope - must poll ... + self signal:aSemaphore onInput:nil orCheck:[aStream canReadWithoutBlocking] ] "Modified: / 14.12.1999 / 23:58:50 / cg" @@ -2504,34 +2504,34 @@ wasBlocked := OperatingSystem blockInterrupts. aFileDescriptor isNil ifTrue:[ - (writeCheckArray identityIndexOf:aBlock startingAt:1) == 0 ifTrue:[ - idx := writeFdArray identityIndexOf:nil startingAt:1. - idx ~~ 0 ifTrue:[ - writeFdArray at:idx put:aFileDescriptor. - writeSemaphoreArray at:idx put:aSemaphore. - writeCheckArray at:idx put:aBlock - ] ifFalse:[ - writeFdArray := writeFdArray copyWith:nil. - writeSemaphoreArray := writeSemaphoreArray copyWith:aSemaphore. - writeCheckArray := writeCheckArray copyWith:aBlock. - ] - ] + (writeCheckArray identityIndexOf:aBlock startingAt:1) == 0 ifTrue:[ + idx := writeFdArray identityIndexOf:nil startingAt:1. + idx ~~ 0 ifTrue:[ + writeFdArray at:idx put:aFileDescriptor. + writeSemaphoreArray at:idx put:aSemaphore. + writeCheckArray at:idx put:aBlock + ] ifFalse:[ + writeFdArray := writeFdArray copyWith:nil. + writeSemaphoreArray := writeSemaphoreArray copyWith:aSemaphore. + writeCheckArray := writeCheckArray copyWith:aBlock. + ] + ] ] ifFalse:[ - (writeFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[ - idx := writeFdArray identityIndexOf:nil startingAt:1. - idx ~~ 0 ifTrue:[ - writeFdArray at:idx put:aFileDescriptor. - writeSemaphoreArray at:idx put:aSemaphore. - writeCheckArray at:idx put:aBlock - ] ifFalse:[ - writeFdArray := writeFdArray copyWith:aFileDescriptor. - writeSemaphoreArray := writeSemaphoreArray copyWith:aSemaphore. - writeCheckArray := writeCheckArray copyWith:aBlock. - ]. - useIOInterrupts ifTrue:[ - OperatingSystem enableIOInterruptsOn:aFileDescriptor - ]. - ] + (writeFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[ + idx := writeFdArray identityIndexOf:nil startingAt:1. + idx ~~ 0 ifTrue:[ + writeFdArray at:idx put:aFileDescriptor. + writeSemaphoreArray at:idx put:aSemaphore. + writeCheckArray at:idx put:aBlock + ] ifFalse:[ + writeFdArray := writeFdArray copyWith:aFileDescriptor. + writeSemaphoreArray := writeSemaphoreArray copyWith:aSemaphore. + writeCheckArray := writeCheckArray copyWith:aBlock. + ]. + useIOInterrupts ifTrue:[ + OperatingSystem enableIOInterruptsOn:aFileDescriptor + ]. + ] ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -2545,11 +2545,11 @@ otherwise, it will be polled every few milliseconds (MSDOS)." aStream canBeSelected ifTrue:[ - "/ can this stream be selected on ? - self signal:aSemaphore onOutput:aStream fileDescriptor orCheck:nil + "/ can this stream be selected on ? + self signal:aSemaphore onOutput:aStream fileDescriptor orCheck:nil ] ifFalse:[ - "/ nope - must poll ... - self signal:aSemaphore onOutput:nil orCheck:[aStream canWriteWithoutBlocking] + "/ nope - must poll ... + self signal:aSemaphore onOutput:nil orCheck:[aStream canWriteWithoutBlocking] ] "Modified: / 14.12.1999 / 23:59:19 / cg" @@ -2566,18 +2566,18 @@ Using IO interrupts reduces the idle CPU usage of ST/X by some percent (typically 2-7%). Notice: - some systems do not support IO-interrupts (or have a broken stdio-lib), - and this feature is always disabled; + some systems do not support IO-interrupts (or have a broken stdio-lib), + and this feature is always disabled; Also notice: - we found that in some Xlib-implementations, interrupted reads are not - handled correctly (especially in multi-headed applications), and this - feature should be disabled to avoid a blocking XPending. + we found that in some Xlib-implementations, interrupted reads are not + handled correctly (especially in multi-headed applications), and this + feature should be disabled to avoid a blocking XPending. If this method is used to disable IO interrupts in multi-headed apps, it should be invoked BEFORE the display event dispatcher processes are started." OperatingSystem supportsIOInterrupts ifTrue:[ - useIOInterrupts := aBoolean + useIOInterrupts := aBoolean ]. "Created: / 15.7.1998 / 13:32:29 / cg" @@ -2695,21 +2695,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. @@ -2736,10 +2736,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 @@ -2762,9 +2762,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" @@ -2873,10 +2873,10 @@ wasBlocked := OperatingSystem blockInterrupts. index := timeoutActionArray identityIndexOf:aBlock startingAt:1. (index ~~ 0) ifTrue:[ - timeoutArray at:index put:nil. - timeoutActionArray at:index put:nil. - timeoutSemaphoreArray at:index put:nil. - timeoutProcessArray at:index put:nil. + timeoutArray at:index put:nil. + timeoutActionArray at:index put:nil. + timeoutSemaphoreArray at:index put:nil. + timeoutProcessArray at:index put:nil. ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. ! @@ -2890,14 +2890,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" @@ -2906,28 +2906,28 @@ timeoutHandlerProcess (timeoutHandlerProcess isNil or:[timeoutHandlerProcess isDead]) ifTrue:[ - timeoutHandlerProcess := - [ - [ - [true] whileTrue:[ - [ - self timeoutHandlerProcessLoop - ] on:Exception do:[:ex| - "ignore errors, but tell the user" - ('ProcessorScheduler [warning]: error while handling timeouts in TimeoutHandlerProcess: ''' , ex description , '''') infoPrintCR. + timeoutHandlerProcess := + [ + [ + [true] whileTrue:[ + [ + self timeoutHandlerProcessLoop + ] on:Exception do:[:ex| + "ignore errors, but tell the user" + ('ProcessorScheduler [warning]: error while handling timeouts in TimeoutHandlerProcess: ''' , ex description , '''') infoPrintCR. "/ thisContext fullPrintAll. - ]. - ] - ] ensure:[ - timeoutHandlerProcess := nil - ]. - ] newProcess. - - timeoutHandlerProcess - priority:TimingPriority; - name:'Timeout handler'; - beSystemProcess; - resume. + ]. + ] + ] ensure:[ + timeoutHandlerProcess := nil + ]. + ] newProcess. + + timeoutHandlerProcess + priority:TimingPriority; + name:'Timeout handler'; + beSystemProcess; + resume. ]. ^ timeoutHandlerProcess. @@ -2954,7 +2954,7 @@ wasBlocked := OperatingSystem blockInterrupts. preWaitActions isNil ifTrue:[ - preWaitActions := OrderedCollection new + preWaitActions := OrderedCollection new ]. preWaitActions add:aBlock. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -3166,8 +3166,8 @@ gotIOInterrupt := true. activeProcess ~~ scheduler ifTrue:[ - interruptedProcess := activeProcess. - self threadSwitch:scheduler + interruptedProcess := activeProcess. + self threadSwitch:scheduler ] "Modified: 21.12.1995 / 16:17:40 / stefan" @@ -3185,49 +3185,49 @@ readFdArray/writeFdArray in the debugger)" readFdArray keysAndValuesDo:[:idx :fd | - |rslt sema| - - (fd notNil "and:[fd >= 0]") ifTrue:[ - rslt := OperatingSystem - selectOnAnyReadable:(Array with:fd) - writable:nil - exception:nil - withTimeOut:0. - - (rslt == #error or:[rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]]) ifTrue:[ - "/ ('Processor [info]: removing invalid read-select fileDescriptor: ' , fd printString) infoPrintCR. - readFdArray at:idx put:nil. - readCheckArray at:idx put:nil. - OperatingSystem clearLastErrorNumber. - (sema := readSemaphoreArray at:idx) notNil ifTrue:[ - readSemaphoreArray at:idx put:nil. - sema signal. - ]. - ] - ]. + |rslt sema| + + (fd notNil "and:[fd >= 0]") ifTrue:[ + rslt := OperatingSystem + selectOnAnyReadable:(Array with:fd) + writable:nil + exception:nil + withTimeOut:0. + + (rslt == #error or:[rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]]) ifTrue:[ + "/ ('Processor [info]: removing invalid read-select fileDescriptor: ' , fd printString) infoPrintCR. + readFdArray at:idx put:nil. + readCheckArray 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| - - fd notNil ifTrue:[ - rslt := OperatingSystem - selectOnAnyReadable:nil - writable:(Array with:fd) - exception:nil - withTimeOut:0. - - (rslt == #error or:[rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]]) ifTrue:[ - "/ ('Processor [info]: removing invalid write-select fileDescriptor: ' , fd printString) infoPrintCR. - writeFdArray at:idx put:nil. - writeCheckArray at:idx put:nil. - OperatingSystem clearLastErrorNumber. - (sema := writeSemaphoreArray at:idx) notNil ifTrue:[ - writeSemaphoreArray at:idx put:nil. - sema signal. - ]. - ] - ] + |rslt sema| + + fd notNil ifTrue:[ + rslt := OperatingSystem + selectOnAnyReadable:nil + writable:(Array with:fd) + exception:nil + withTimeOut:0. + + (rslt == #error or:[rslt isNil and:[OperatingSystem lastErrorSymbol == #EBADF]]) ifTrue:[ + "/ ('Processor [info]: removing invalid write-select fileDescriptor: ' , fd printString) infoPrintCR. + writeFdArray at:idx put:nil. + writeCheckArray 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" @@ -3239,8 +3239,8 @@ what to do now." activeProcess ~~ scheduler ifTrue:[ - interruptedProcess := activeProcess. - self threadSwitch:scheduler + interruptedProcess := activeProcess. + self threadSwitch:scheduler ] ! @@ -3290,8 +3290,8 @@ of whichever process is currently running." activeProcess ~~ scheduler ifTrue:[ - interruptedProcess := activeProcess. - self threadSwitch:scheduler + interruptedProcess := activeProcess. + self threadSwitch:scheduler ] "Modified: 18.10.1996 / 20:35:54 / cg" @@ -3308,86 +3308,86 @@ doingGC := true. [doingGC] whileTrue:[ - anyTimeouts ifTrue:[ - millis := self timeToNextTimeout. - (millis notNil and:[millis <= 0]) ifTrue:[ - ^ self "oops - hurry up checking" - ]. - ]. - - " - if its worth doing, collect a bit of garbage; - but not, if a backgroundCollector is active - " - ObjectMemory backgroundCollectorRunning ifTrue:[ - doingGC := false - ] ifFalse:[ - doingGC := ObjectMemory gcStepIfUseful. - ]. - - "then do idle actions" - (idleActions notNil and:[idleActions size ~~ 0]) ifTrue:[ - idleActions do:[:aBlock | - aBlock value. - ]. - ^ self "go back checking" - ]. - - doingGC ifTrue:[ - (self checkForIOWithTimeout:0) ifTrue:[ - ^ self "go back checking" - ] - ] + anyTimeouts ifTrue:[ + millis := self timeToNextTimeout. + (millis notNil and:[millis <= 0]) ifTrue:[ + ^ self "oops - hurry up checking" + ]. + ]. + + " + if its worth doing, collect a bit of garbage; + but not, if a backgroundCollector is active + " + ObjectMemory backgroundCollectorRunning ifTrue:[ + doingGC := false + ] ifFalse:[ + doingGC := ObjectMemory gcStepIfUseful. + ]. + + "then do idle actions" + (idleActions notNil and:[idleActions size ~~ 0]) ifTrue:[ + idleActions do:[:aBlock | + aBlock value. + ]. + ^ self "go back checking" + ]. + + doingGC ifTrue:[ + (self checkForIOWithTimeout:0) ifTrue:[ + ^ self "go back checking" + ] + ] ]. exitWhenNoMoreUserProcesses ifTrue:[ - "/ check if there are any processes at all - "/ stop dispatching if there is none - "/ (and millis is nil, which means that no timeout blocks are present) - "/ and no readSemaphores are present (which means that noone is waiting for input) - "/ and no writeSemaphores are present - - anySema := (readSemaphoreArray findFirst:[:sema | sema notNil]) ~~ 0. - anySema ifFalse:[ - anySema := (writeSemaphoreArray findFirst:[:sema | sema notNil]) ~~ 0. - ]. - anySema ifFalse:[ - self anyUserProcessAtAll ifFalse:[ - dispatching := false. - ^ self - ] - ]. + "/ check if there are any processes at all + "/ stop dispatching if there is none + "/ (and millis is nil, which means that no timeout blocks are present) + "/ and no readSemaphores are present (which means that noone is waiting for input) + "/ and no writeSemaphores are present + + anySema := (readSemaphoreArray findFirst:[:sema | sema notNil]) ~~ 0. + anySema ifFalse:[ + anySema := (writeSemaphoreArray findFirst:[:sema | sema notNil]) ~~ 0. + ]. + anySema ifFalse:[ + self anyUserProcessAtAll ifFalse:[ + dispatching := false. + ^ self + ] + ]. ]. preWaitActions notNil ifTrue:[ - preWaitActions do:[:action | action value]. + preWaitActions do:[:action | action value]. ]. "/ "/ absolutely nothing to do - simply wait "/ OperatingSystem supportsSelect ifFalse:[ - "SCO instant ShitStation has a bug here, - waiting always 1 sec in the select - therefore we delay a bit and - return - effectively polling in 50ms cycles - " - (self checkForIOWithTimeout:0) ifTrue:[ - ^ self "go back checking" - ]. - OperatingSystem millisecondDelay:EventPollingInterval. - ^ self + "SCO instant ShitStation has a bug here, + waiting always 1 sec in the select - therefore we delay a bit and + return - effectively polling in 50ms cycles + " + (self checkForIOWithTimeout:0) ifTrue:[ + ^ self "go back checking" + ]. + OperatingSystem millisecondDelay:EventPollingInterval. + ^ self ]. useIOInterrupts ifTrue:[ - dT := 999999 + dT := 999999 ] ifFalse:[ - dT := EventPollingInterval + dT := EventPollingInterval ]. millis isNil ifTrue:[ - millis := dT. + millis := dT. ] ifFalse:[ - millis := millis rounded min:dT. + millis := millis rounded min:dT. ]. self checkForIOWithTimeout:millis @@ -3399,11 +3399,11 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.275 2013-08-20 13:51:59 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.276 2013-08-20 13:56:31 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.275 2013-08-20 13:51:59 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.276 2013-08-20 13:56:31 cg Exp $' ! !