From f4b9e21f2b718572d2c8569ea0cae30cb497bcc5 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 16 May 2000 17:48:58 +0000 Subject: [PATCH] Handle some OS/390-isms dealing with pthreads: . the types of the parameters to pthread_attr_setdetachstate() and pthread_detach() . the fact that sigprocmask() must be use to set a thread's signal mask git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85230 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/mpmt_pthread/mpmt_pthread.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 9764c2e657..1558f5d861 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -837,9 +837,15 @@ static void child_main(int child_num_arg) /* 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, server_conf, "sigprocmask"); + } +#else if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "pthread_sigmask"); } +#endif requests_this_child = ap_max_requests_per_child; @@ -857,7 +863,15 @@ static void child_main(int child_num_arg) pthread_mutex_init(&worker_thread_count_mutex, NULL); pthread_mutex_init(&pipe_of_death_mutex, NULL); pthread_attr_init(&thread_attr); +#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR + { + int on = 1; + + pthread_attr_setdetachstate(&thread_attr, &on); + } +#else pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); +#endif for (i=0; i < ap_threads_per_child; i++) { my_info = (proc_info *)malloc(sizeof(proc_info)); -- 2.50.1