Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 49420 invoked by uid 500); 21 Feb 2001 01:18:39 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 49408 invoked by uid 500); 21 Feb 2001 01:18:39 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 21 Feb 2001 01:18:39 -0000 Message-ID: <20010221011839.49401.qmail@apache.org> From: rbb@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/server/mpm/threaded threaded.c rbb 01/02/20 17:18:39 Modified: . CHANGES include ap_config.h server/mpm/threaded threaded.c Log: Remove the rest of the pthreads functions from the threaded MPM Revision Changes Path 1.101 +4 -0 httpd-2.0/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-2.0/CHANGES,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -b -w -u -r1.100 -r1.101 --- CHANGES 2001/02/21 01:04:39 1.100 +++ CHANGES 2001/02/21 01:18:38 1.101 @@ -1,5 +1,9 @@ Changes with Apache 2.0.12-dev + *) Remove the rest of the pthreads functions from the threaded MPM. + This requires the APR support for a signal thread that was just + added. [Ryan Bloom] + *) Make mod_dir use a fixup for sending a redirect to the browser. Before this, we were using a handler, which doesn't make much sense, because the handler wasn't generating any data, it would 1.57 +0 -6 httpd-2.0/include/ap_config.h Index: ap_config.h =================================================================== RCS file: /home/cvs/httpd-2.0/include/ap_config.h,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -b -w -u -r1.56 -r1.57 --- ap_config.h 2001/02/16 04:26:30 1.56 +++ ap_config.h 2001/02/21 01:18:39 1.57 @@ -223,12 +223,6 @@ #endif -#ifdef SIGWAIT_TAKES_ONE_ARG -#define ap_sigwait(a,b) ((*(b)=sigwait((a)))<0?-1:0) -#else -#define ap_sigwait(a,b) sigwait((a),(b)) -#endif - /* TODO - We need to put OS detection back to make all the following work */ #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \ 1.6 +24 -34 httpd-2.0/server/mpm/threaded/threaded.c Index: threaded.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -b -w -u -r1.5 -r1.6 --- threaded.c 2001/02/20 20:50:09 1.5 +++ threaded.c 2001/02/21 01:18:39 1.6 @@ -93,7 +93,6 @@ #endif #include -#include /* * Actual definitions of config globals @@ -581,11 +580,19 @@ return NULL; } +static int check_signal(int signum) +{ + switch (signum) { + case SIGTERM: + case SIGINT: + just_die(signum); + return 1; + } + return 0; +} static void child_main(int child_num_arg) { - sigset_t sig_mask; - int signal_received; apr_thread_t *thread; apr_threadattr_t *thread_attr; int i; @@ -616,22 +623,8 @@ ap_child_init_hook(pchild, ap_server_conf); /*done with init critical section */ - - /* All threads should mask signals out, accoring to sigwait(2) man page */ - sigfillset(&sig_mask); -#ifdef SIGPROCMASK_SETS_THREAD_MASK - if (sigprocmask(SIG_SETMASK, &sig_mask, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, "sigprocmask"); - } -#else - if ((rv = pthread_sigmask(SIG_SETMASK, &sig_mask, NULL)) != 0) { -#ifdef PTHREAD_SETS_ERRNO - rv = errno; -#endif - ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, "pthread_sigmask"); - } -#endif + apr_setup_signal_thread(); requests_this_child = ap_max_requests_per_child; @@ -654,8 +647,10 @@ apr_threadattr_create(&thread_attr, pchild); apr_threadattr_detach_set(thread_attr); - for (i=0; i < ap_threads_per_child; i++) { + apr_create_signal_thread(&thread, thread_attr, check_signal, pchild); + for (i=0; i < ap_threads_per_child - 1; i++) { + my_info = (proc_info *)malloc(sizeof(proc_info)); if (my_info == NULL) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, @@ -683,22 +678,17 @@ * because it let's us deal with tid better. */ } - - /* This thread will be the one responsible for handling signals */ - sigemptyset(&sig_mask); - sigaddset(&sig_mask, SIGTERM); - sigaddset(&sig_mask, SIGINT); - ap_sigwait(&sig_mask, &signal_received); - switch (signal_received) { - case SIGTERM: - case SIGINT: - just_die(signal_received); - break; - default: + apr_pool_create(&my_info->tpool, pchild); + my_info = (proc_info *)malloc(sizeof(proc_info)); + if (my_info == NULL) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "received impossible signal: %d", signal_received); - just_die(SIGTERM); + "malloc: out of memory"); + clean_child_exit(APEXIT_CHILDFATAL); } + my_info->pid = my_child_num; + my_info->tid = i; + my_info->sd = 0; + worker_thread(my_info); } static int make_child(server_rec *s, int slot)