diff options
author | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-12 21:22:53 +0000 |
---|---|---|
committer | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-12 21:22:53 +0000 |
commit | bd7ce3484dd18373c5f6c4476cc0d209256586b6 (patch) | |
tree | 11d4de891528653d87d93157e2e3232f6c8df15d /memory | |
parent | 01e26eacf54fea2b45edeb7986b714f2e204503c (diff) | |
download | libapr-bd7ce3484dd18373c5f6c4476cc0d209256586b6.tar.gz |
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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64018 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r-- | memory/unix/apr_pools.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 5538b0269..568d3bd4e 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -2088,24 +2088,26 @@ static void free_proc_chain(struct process_chain *procs) 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 |