# HG changeset patch # User Claus Gittinger # Date 886534220 -3600 # Node ID fd52c625f87c7f2cbe7cc668d9b5a4a614b083b3 # Parent 6e3c86ce2a51afd18dc77a3c2d7f3dd6d6aeab1f fixed monitoring for non-sigChild systems (WIN32) diff -r 6e3c86ce2a51 -r fd52c625f87c ProcSched.st --- a/ProcSched.st Tue Feb 03 19:01:58 1998 +0100 +++ b/ProcSched.st Tue Feb 03 20:30:20 1998 +0100 @@ -826,50 +826,64 @@ |pid blocked osProcessStatus| OperatingSystem supportsChildInterrupts 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, fork a high prio process - "/ to poll for for the exit of pid. - - pid := aBlockReturningPid value. - [ - |polling| - - polling := true. - [polling] whileTrue:[ - Delay waitForMilliseconds:EventPollingInterval. - (osChildExitActions includesKey:pid) ifFalse:[ - polling := false. - ] ifTrue:[ - osProcessStatus := OperatingSystem childProcessWait:false pid:pid. - osProcessStatus notNil ifTrue:[ - (osProcessStatus pid = pid) ifTrue:[ - actionBlock value:osProcessStatus. - polling := false. - ] ifFalse:[ - osProcessStatus stillAlive - ] - ] - ]. - ] - ] forkAt:TimingPriority. + "/ SIGCHLD is not supported, fork a high prio process + "/ to poll for for the exit of pid. + + blocked := OperatingSystem blockInterrupts. + pid := aBlockReturningPid value. + pid notNil ifTrue:[ + osChildExitActions at:pid put:actionBlock. + ]. + blocked ifFalse:[ + OperatingSystem unblockInterrupts. + ]. + + [ + [ + |polling| + + polling := true. + [polling] whileTrue:[ + Delay waitForMilliseconds:EventPollingInterval. + (osChildExitActions includesKey:pid) ifFalse:[ + polling := false. + ] ifTrue:[ + osProcessStatus := OperatingSystem childProcessWait:false pid:pid. + osProcessStatus notNil ifTrue:[ + (osProcessStatus pid = pid) ifTrue:[ + osChildExitActions removeKey:pid ifAbsent:nil. + actionBlock value:osProcessStatus. + polling := false. + ] ifFalse:[ + osProcessStatus stillAlive + ] + ] + ]. + ] + ] valueOnUnwindDo:[ + osChildExitActions removeKey:pid ifAbsent:nil + ] + ] forkAt:TimingPriority. ]. ^ pid - "Created: 25.3.1997 / 10:54:56 / stefan" - "Modified: 25.3.1997 / 11:21:05 / stefan" - "Modified: 15.04.1997 / 11:55:57 / David " + "Created: / 25.3.1997 / 10:54:56 / stefan" + "Modified: / 25.3.1997 / 11:21:05 / stefan" + "Modified: / 15.4.1997 / 11:55:57 / David" + "Modified: / 28.1.1998 / 18:13:23 / cg" ! unmonitorPid:pid @@ -2620,6 +2634,6 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.143 1998-01-29 16:05:21 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.144 1998-02-03 19:30:20 cg Exp $' ! ! ProcessorScheduler initialize! diff -r 6e3c86ce2a51 -r fd52c625f87c ProcessorScheduler.st --- a/ProcessorScheduler.st Tue Feb 03 19:01:58 1998 +0100 +++ b/ProcessorScheduler.st Tue Feb 03 20:30:20 1998 +0100 @@ -826,50 +826,64 @@ |pid blocked osProcessStatus| OperatingSystem supportsChildInterrupts 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, fork a high prio process - "/ to poll for for the exit of pid. - - pid := aBlockReturningPid value. - [ - |polling| - - polling := true. - [polling] whileTrue:[ - Delay waitForMilliseconds:EventPollingInterval. - (osChildExitActions includesKey:pid) ifFalse:[ - polling := false. - ] ifTrue:[ - osProcessStatus := OperatingSystem childProcessWait:false pid:pid. - osProcessStatus notNil ifTrue:[ - (osProcessStatus pid = pid) ifTrue:[ - actionBlock value:osProcessStatus. - polling := false. - ] ifFalse:[ - osProcessStatus stillAlive - ] - ] - ]. - ] - ] forkAt:TimingPriority. + "/ SIGCHLD is not supported, fork a high prio process + "/ to poll for for the exit of pid. + + blocked := OperatingSystem blockInterrupts. + pid := aBlockReturningPid value. + pid notNil ifTrue:[ + osChildExitActions at:pid put:actionBlock. + ]. + blocked ifFalse:[ + OperatingSystem unblockInterrupts. + ]. + + [ + [ + |polling| + + polling := true. + [polling] whileTrue:[ + Delay waitForMilliseconds:EventPollingInterval. + (osChildExitActions includesKey:pid) ifFalse:[ + polling := false. + ] ifTrue:[ + osProcessStatus := OperatingSystem childProcessWait:false pid:pid. + osProcessStatus notNil ifTrue:[ + (osProcessStatus pid = pid) ifTrue:[ + osChildExitActions removeKey:pid ifAbsent:nil. + actionBlock value:osProcessStatus. + polling := false. + ] ifFalse:[ + osProcessStatus stillAlive + ] + ] + ]. + ] + ] valueOnUnwindDo:[ + osChildExitActions removeKey:pid ifAbsent:nil + ] + ] forkAt:TimingPriority. ]. ^ pid - "Created: 25.3.1997 / 10:54:56 / stefan" - "Modified: 25.3.1997 / 11:21:05 / stefan" - "Modified: 15.04.1997 / 11:55:57 / David " + "Created: / 25.3.1997 / 10:54:56 / stefan" + "Modified: / 25.3.1997 / 11:21:05 / stefan" + "Modified: / 15.4.1997 / 11:55:57 / David" + "Modified: / 28.1.1998 / 18:13:23 / cg" ! unmonitorPid:pid @@ -2620,6 +2634,6 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.143 1998-01-29 16:05:21 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.144 1998-02-03 19:30:20 cg Exp $' ! ! ProcessorScheduler initialize!