fixed monitoring for non-sigChild systems (WIN32)
authorClaus Gittinger <cg@exept.de>
Tue, 03 Feb 1998 20:30:20 +0100
changeset 3270 fd52c625f87c
parent 3269 6e3c86ce2a51
child 3271 f9b081667d3e
fixed monitoring for non-sigChild systems (WIN32)
ProcSched.st
ProcessorScheduler.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!
--- 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!