WIN32: do not monitor nil-pid processes (i.e. if it failed)
authorClaus Gittinger <cg@exept.de>
Tue, 27 Nov 2001 18:57:41 +0100
changeset 6238 cefe40ecf525
parent 6237 4dc908af4f5c
child 6239 cbb8d880fb25
WIN32: do not monitor nil-pid processes (i.e. if it failed)
ProcessorScheduler.st
--- a/ProcessorScheduler.st	Tue Nov 27 18:30:54 2001 +0100
+++ b/ProcessorScheduler.st	Tue Nov 27 18:57:41 2001 +0100
@@ -1109,62 +1109,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.
-
-	blocked := OperatingSystem blockInterrupts.
-	pid := aBlockReturningPid value.
-	pid notNil ifTrue:[
-	    osChildExitActions at:pid put:actionBlock.
-	].
-	blocked ifFalse:[
-	    OperatingSystem unblockInterrupts.
-	].
-
-	[
-	    [
-	      |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:[
-			      osChildExitActions removeKey:pid ifAbsent:nil.
-			      actionBlock value:osProcessStatus.
-			      polling := false.
-			  ] ifFalse:[
-			      osProcessStatus stillAlive
-			  ]
-		      ]
-		  ]. 
-	      ]
-	  ] valueOnUnwindDo:[
-	      osChildExitActions removeKey:pid ifAbsent:nil
-	  ]
-	] 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.
+        ].
+
+        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:[
+                                  osChildExitActions removeKey:pid ifAbsent:nil.
+                                  actionBlock value:osProcessStatus.
+                                  polling := false.
+                              ] ifFalse:[
+                                  osProcessStatus stillAlive
+                              ]
+                          ]
+                      ]. 
+                  ]
+              ] valueOnUnwindDo:[
+                  osChildExitActions removeKey:pid ifAbsent:nil
+              ]
+            ] forkAt:TimingPriority.
+        ].
     ].
     ^ pid
 
@@ -3139,6 +3141,6 @@
 !ProcessorScheduler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.193 2001-11-17 10:14:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.194 2001-11-27 17:57:41 cg Exp $'
 ! !
 ProcessorScheduler initialize!