]> granicus.if.org Git - apache/commitdiff
Convert the apr_create_signal_thread to apr_signal_thread. The main
authorRyan Bloom <rbb@apache.org>
Thu, 12 Apr 2001 18:46:32 +0000 (18:46 +0000)
committerRyan Bloom <rbb@apache.org>
Thu, 12 Apr 2001 18:46:32 +0000 (18:46 +0000)
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
server/mpm/perchild/perchild.c
server/mpm/threaded/threaded.c

index d08bb769a716bd137df90b7436f6c3f52fda8932..c796509dcc56d6b58814b46543f5c35c751f83dc 100644 (file)
@@ -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)
index d08bb769a716bd137df90b7436f6c3f52fda8932..c796509dcc56d6b58814b46543f5c35c751f83dc 100644 (file)
@@ -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)
index 96bfada8424cc22ffbea700d57a4164f68e10677..1a9415912fd61820f29d116bc4a33a90cc3f27e4 100644 (file)
@@ -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)