Commit 3df26323 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

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
parent f2f86a41
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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)
+1 −4
Original line number Diff line number Diff line
@@ -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)
+2 −22
Original line number Diff line number Diff line
@@ -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)