From 0ae1f4be67bd3133af34925f352d4ea12615699a Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Thu, 12 Apr 2001 18:46:32 +0000 Subject: [PATCH] Convert the apr_create_signal_thread to apr_signal_thread. The main difference, is that instead of creating a separate thread to listen for signals, the thread that calls this function does the listening. Many platforms have issues when the main thread isn't the thread that is listening for signals. Even more platforms complain when the main thread dies, but the process doesn't. This gets the main thread back to being the signal handling thread. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88831 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/perchild/perchild.c | 5 +---- server/mpm/perchild/perchild.c | 5 +---- server/mpm/threaded/threaded.c | 24 ++------------------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index d08bb769a7..c796509dcc 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -918,7 +918,6 @@ static void child_main(int child_num_arg) apr_threadattr_create(&worker_thread_attr, pchild); apr_threadattr_detach_set(worker_thread_attr, 1); - apr_create_signal_thread(&thread, worker_thread_attr, check_signal, pchild); /* We are creating worker threads right now */ for (i=0; i < threads_to_start; i++) { @@ -928,9 +927,7 @@ static void child_main(int child_num_arg) } } - /* This thread will be be a worker thread too. */ - worker_thread(&worker_thread_free_ids[max_threads - 1]); - + apr_signal_thread_func(check_signal); } static int make_child(server_rec *s, int slot) diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index d08bb769a7..c796509dcc 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -918,7 +918,6 @@ static void child_main(int child_num_arg) apr_threadattr_create(&worker_thread_attr, pchild); apr_threadattr_detach_set(worker_thread_attr, 1); - apr_create_signal_thread(&thread, worker_thread_attr, check_signal, pchild); /* We are creating worker threads right now */ for (i=0; i < threads_to_start; i++) { @@ -928,9 +927,7 @@ static void child_main(int child_num_arg) } } - /* This thread will be be a worker thread too. */ - worker_thread(&worker_thread_free_ids[max_threads - 1]); - + apr_signal_thread_func(check_signal); } static int make_child(server_rec *s, int slot) diff --git a/server/mpm/threaded/threaded.c b/server/mpm/threaded/threaded.c index 96bfada842..1a9415912f 100644 --- a/server/mpm/threaded/threaded.c +++ b/server/mpm/threaded/threaded.c @@ -650,7 +650,6 @@ static void child_main(int child_num_arg) listensocks[i]=lr->sd; /* Setup worker threads */ - worker_thread_count = 0; apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS, NULL, pchild); @@ -659,14 +658,7 @@ static void child_main(int child_num_arg) apr_threadattr_create(&thread_attr, pchild); apr_threadattr_detach_set(thread_attr, 1); - rv = apr_create_signal_thread(&thread, thread_attr, check_signal, pchild); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "Couldn't create signal thread"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - for (i=0; i < ap_threads_per_child - 1; i++) { + for (i=0; i < ap_threads_per_child; i++) { my_info = (proc_info *)malloc(sizeof(proc_info)); if (my_info == NULL) { @@ -695,19 +687,7 @@ static void child_main(int child_num_arg) * because it let's us deal with tid better. */ } - my_info = (proc_info *)malloc(sizeof(proc_info)); - if (my_info == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "malloc: out of memory"); - clean_child_exit(APEXIT_CHILDFATAL); - } - my_info->pid = my_child_num; - my_info->tid = i; - my_info->sd = 0; - apr_pool_create(&my_info->tpool, pchild); - ap_update_child_status(my_child_num, i, SERVER_STARTING, - (request_rec *) NULL); - worker_thread(my_info); + apr_signal_thread(check_signal); } static int make_child(server_rec *s, int slot) -- 2.40.0