stoddard 2002/11/12 13:22:54
Modified: memory/unix apr_pools.c
Log:
Fix a couple of logic bugs:
1. The previous code was missing the last sleep cycle, thus we would wait
only half
the time we should have been waiting.
2. We were incorrectly setting the need_timeout flag if pc->kill_how was not
APR_KILL_AFTER_TIMEOUT
Revision Changes Path
1.190 +19 -17 apr/memory/unix/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -r1.189 -r1.190
--- apr_pools.c 12 Nov 2002 04:24:51 -0000 1.189
+++ apr_pools.c 12 Nov 2002 21:22:53 -0000 1.190
@@ -2088,24 +2088,26 @@
if (need_timeout) {
timeout_interval = TIMEOUT_INTERVAL;
apr_sleep(timeout_interval);
- }
- while (need_timeout) {
- need_timeout = 0;
- /* check the status of the subprocesses */
- for (pc = procs; pc; pc = pc->next) {
- if (pc->kill_how == APR_KILL_AFTER_TIMEOUT &&
- apr_proc_wait(pc->pid, NULL, NULL, APR_NOWAIT) !=
APR_CHILD_NOTDONE)
- pc->kill_how = APR_KILL_NEVER; /* subprocess has
exited */
- else
- need_timeout = 1; /* subprocess is still active */
- }
- if (need_timeout) {
- apr_sleep(timeout_interval);
- timeout_interval *= 2;
- if (timeout_interval >= TIMEOUT_USECS) {
- break;
+
+ do {
+ /* check the status of the subprocesses */
+ need_timeout = 0;
+ for (pc = procs; pc; pc = pc->next) {
+ if (pc->kill_how == APR_KILL_AFTER_TIMEOUT) {
+ if (apr_proc_wait(pc->pid, NULL, NULL, APR_NOWAIT) ==
APR_CHILD_NOTDONE)
+ need_timeout = 1; /* subprocess is still
active */
+ else
+ pc->kill_how = APR_KILL_NEVER; /* subprocess
has exited */
+ }
}
- }
+ if (need_timeout) {
+ if (timeout_interval >= TIMEOUT_USECS) {
+ break;
+ }
+ apr_sleep(timeout_interval);
+ timeout_interval *= 2;
+ }
+ } while (need_timeout);
}
/* OK, the scripts we just timed out for have had a chance to clean up