summaryrefslogtreecommitdiffstats
path: root/modules/http2/h2_workers.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2020-12-06 23:46:42 +0100
committerYann Ylavic <ylavic@apache.org>2020-12-06 23:46:42 +0100
commitc681e08333b7e75df975ab7eeacf7dabe9eb1632 (patch)
tree8cef6cc4e4dc7bf28168f4a490c775af8cb77ab8 /modules/http2/h2_workers.c
parentmod_http2: revert r1883675. (diff)
downloadapache2-c681e08333b7e75df975ab7eeacf7dabe9eb1632.tar.xz
apache2-c681e08333b7e75df975ab7eeacf7dabe9eb1632.zip
mod_http2: Rename server_pool as pchild in h2_workers_create()
To clarify which parent pool the workers threads have. And add a comment about workers_pool_cleanup()'s role and when it runs. No functional change. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1884169 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--modules/http2/h2_workers.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c
index 949ae439c7..999f7a6e54 100644
--- a/modules/http2/h2_workers.c
+++ b/modules/http2/h2_workers.c
@@ -277,7 +277,7 @@ static apr_status_t workers_pool_cleanup(void *data)
return APR_SUCCESS;
}
-h2_workers *h2_workers_create(server_rec *s, apr_pool_t *server_pool,
+h2_workers *h2_workers_create(server_rec *s, apr_pool_t *pchild,
int min_workers, int max_workers,
int idle_secs)
{
@@ -287,14 +287,14 @@ h2_workers *h2_workers_create(server_rec *s, apr_pool_t *server_pool,
int i, n;
ap_assert(s);
- ap_assert(server_pool);
+ ap_assert(pchild);
/* let's have our own pool that will be parent to all h2_worker
* instances we create. This happens in various threads, but always
* guarded by our lock. Without this pool, all subpool creations would
* happen on the pool handed to us, which we do not guard.
*/
- apr_pool_create(&pool, server_pool);
+ apr_pool_create(&pool, pchild);
apr_pool_tag(pool, "h2_workers");
workers = apr_pcalloc(pool, sizeof(h2_workers));
if (!workers) {
@@ -365,6 +365,10 @@ h2_workers *h2_workers_create(server_rec *s, apr_pool_t *server_pool,
workers->dynamic = (workers->worker_count < workers->max_workers);
}
if (status == APR_SUCCESS) {
+ /* Stop/join the workers threads when the MPM child exits (pchild is
+ * destroyed), as a pre_cleanup of workers->pool so that the threads
+ * don't last more than the resources they are using.
+ */
apr_pool_pre_cleanup_register(pool, workers, workers_pool_cleanup);
return workers;
}