summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2002-04-03 15:10:56 +0200
committerJeff Trawick <trawick@apache.org>2002-04-03 15:10:56 +0200
commitcdb0212dd2eba74eb052c41f7de01adeb25d7c4c (patch)
tree6752daa38498667f218b392f30ea85dd20885fd1 /server
parent Elimiate references of subreferences to simplify rebuild logic (diff)
downloadapache2-cdb0212dd2eba74eb052c41f7de01adeb25d7c4c.tar.xz
apache2-cdb0212dd2eba74eb052c41f7de01adeb25d7c4c.zip
Allow worker MPM to build on systems without pthread_kill().
Submitted by: Pier Fumagalli (and mangled by Jeff) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94417 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/mpm/worker/config5.m41
-rw-r--r--server/mpm/worker/worker.c18
2 files changed, 15 insertions, 4 deletions
diff --git a/server/mpm/worker/config5.m4 b/server/mpm/worker/config5.m4
index 52ab50e82c..cc13134845 100644
--- a/server/mpm/worker/config5.m4
+++ b/server/mpm/worker/config5.m4
@@ -1,5 +1,6 @@
dnl ## XXX - Need a more thorough check of the proper flags to use
if test "$MPM_NAME" = "worker" ; then
+ AC_CHECK_FUNCS(pthread_kill)
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
fi
diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c
index 1e5d7c9c07..d92da0cbaa 100644
--- a/server/mpm/worker/worker.c
+++ b/server/mpm/worker/worker.c
@@ -255,11 +255,15 @@ static void wakeup_listener(void)
{
listener_may_exit = 1;
/*
- * we should just be able to "kill(ap_my_pid, LISTENER_SIGNAL)" and wake
- * up the listener thread since it is the only thread with SIGHUP
- * unblocked, but that doesn't work on Linux
+ * we should just be able to "kill(ap_my_pid, LISTENER_SIGNAL)" on all
+ * platforms and wake up the listener thread since it is the only thread
+ * with SIGHUP unblocked, but that doesn't work on Linux
*/
+#ifdef HAVE_PTHREAD_KILL
pthread_kill(*listener_os_thread, LISTENER_SIGNAL);
+#else
+ kill(ap_my_pid, LISTENER_SIGNAL);
+#endif
}
#define ST_INIT 0
@@ -1043,7 +1047,13 @@ static void join_workers(apr_thread_t *listener, apr_thread_t **threads)
*/
iter = 0;
- while (iter < 10 && pthread_kill(*listener_os_thread, 0) == 0) {
+ while (iter < 10 &&
+#ifdef HAVE_PTHREAD_KILL
+ pthread_kill(*listener_os_thread, 0)
+#else
+ kill(ap_my_pid, 0)
+#endif
+ == 0) {
/* listener not dead yet */
apr_sleep(APR_USEC_PER_SEC / 2);
wakeup_listener();