wrowe 2003/01/03 11:14:13
Modified: misc/unix otherchild.c
Log:
This clears up the win32 testoc case... please review for accuracy
of the original intent of Unix's oc logic.
Revision Changes Path
1.29 +18 -4 apr/misc/unix/otherchild.c
Index: otherchild.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/otherchild.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- otherchild.c 1 Jan 2003 00:01:52 -0000 1.28
+++ otherchild.c 3 Jan 2003 19:14:13 -0000 1.29
@@ -163,7 +163,7 @@
APR_DECLARE(void) apr_proc_other_child_check(void)
{
apr_other_child_rec_t *ocr, *nocr;
- apr_status_t rv;
+ DWORD status;
/* Todo:
* Implement code to detect if a pipe is still alive on Windows.
@@ -176,13 +176,27 @@
if (ocr->proc == NULL)
continue;
- rv = WaitForSingleObject(ocr->proc->hproc, 0);
- if (rv != WAIT_TIMEOUT) {
+ if (!ocr->proc->hproc) {
+ /* Already mopped up, perhaps we apr_proc_kill'ed it */
+ (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, -1);
+ }
+ else if (!GetExitCodeProcess(ocr->proc->hproc, &status)) {
+ CloseHandle(ocr->proc->hproc);
+ ocr->proc = NULL;
(*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1);
}
+ else if (status == STILL_ACTIVE) {
+ (*ocr->maintenance) (APR_OC_REASON_RESTART, ocr->data, -1);
+ }
+ else {
+ CloseHandle(ocr->proc->hproc);
+ ocr->proc->hproc = NULL;
+ ocr->proc = NULL;
+ (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status);
+ }
}
}
-#else /* Win32 */
+#else /* ndef Win32 */
APR_DECLARE(void) apr_proc_other_child_check(void)
{
apr_other_child_rec_t *ocr, *nocr;