From 6ef1b748b2ccabe0fb5f24a543d9912c12228c00 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Mon, 4 Jan 2016 16:56:28 +0000 Subject: [PATCH] Follow up to r1722914: since worker threads are joined in cleanup_zombies, they are not anymore detached nor joined elsewhere. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1722918 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http2/h2_io.c | 1 + modules/http2/h2_worker.c | 22 ++++------------------ modules/http2/h2_workers.c | 1 - 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/modules/http2/h2_io.c b/modules/http2/h2_io.c index 2ff45b2c73..5a2ad8f8b6 100644 --- a/modules/http2/h2_io.c +++ b/modules/http2/h2_io.c @@ -15,6 +15,7 @@ #include +#include #include #include diff --git a/modules/http2/h2_worker.c b/modules/http2/h2_worker.c index f3f2b9b5c0..775a486912 100644 --- a/modules/http2/h2_worker.c +++ b/modules/http2/h2_worker.c @@ -101,19 +101,6 @@ static void* APR_THREAD_FUNC execute(apr_thread_t *thread, void *wctx) return NULL; } -static apr_status_t cleanup_join_thread(void *ctx) -{ - h2_worker *w = ctx; - /* do the join only when the worker is aborted. Otherwise, - * we are probably in a process shutdown. - */ - if (w->thread && w->aborted) { - apr_status_t rv; - apr_thread_join(&rv, w->thread); - } - return APR_SUCCESS; -} - h2_worker *h2_worker_create(int id, apr_pool_t *parent_pool, apr_threadattr_t *attr, @@ -147,7 +134,6 @@ h2_worker *h2_worker_create(int id, return NULL; } - apr_pool_pre_cleanup_register(w->pool, w, cleanup_join_thread); apr_pool_create(&w->task_pool, w->pool); apr_thread_create(&w->thread, attr, execute, w, w->pool); } @@ -156,15 +142,15 @@ h2_worker *h2_worker_create(int id, apr_status_t h2_worker_destroy(h2_worker *worker) { - if (worker->io) { - apr_thread_cond_destroy(worker->io); - worker->io = NULL; - } if (worker->thread) { apr_status_t status; apr_thread_join(&status, worker->thread); worker->thread = NULL; } + if (worker->io) { + apr_thread_cond_destroy(worker->io); + worker->io = NULL; + } if (worker->pool) { apr_pool_destroy(worker->pool); /* worker is gone */ diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c index cc0a8dc10c..7542daa699 100644 --- a/modules/http2/h2_workers.c +++ b/modules/http2/h2_workers.c @@ -246,7 +246,6 @@ h2_workers *h2_workers_create(server_rec *s, apr_pool_t *server_pool, apr_atomic_set32(&workers->max_idle_secs, 10); apr_threadattr_create(&workers->thread_attr, workers->pool); - apr_threadattr_detach_set(workers->thread_attr, 1); if (ap_thread_stacksize != 0) { apr_threadattr_stacksize_set(workers->thread_attr, ap_thread_stacksize); -- 2.40.0