]> granicus.if.org Git - apache/commitdiff
Allow worker MPM to build on systems without pthread_kill().
authorJeff Trawick <trawick@apache.org>
Wed, 3 Apr 2002 13:10:56 +0000 (13:10 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 3 Apr 2002 13:10:56 +0000 (13:10 +0000)
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

CHANGES
server/mpm/worker/config5.m4
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 02667e3efb16ff10ccb4987a23a57f8f561d4f5a..1e6c45e24eb9cf41fa7006f5ca80a8243bc6fcb2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.35
 
+  *) Allow worker MPM to build on systems without pthread_kill().
+     [Pier Fumagalli, Jeff Trawick]
+
   *) Prevent ap_add_output_filters_by_type from being called in
      ap_set_content_type if the content-type hasn't changed.
      [Justin Erenkrantz]
index 52ab50e82ce3a9b54261e2d8a280e953396fdac0..cc131348457e23e614d8e19446223336188bc1e1 100644 (file)
@@ -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
index 1e5d7c9c077d096ced30369f41cb1843229c3bde..d92da0cbaaf34c65dd76316d5abecc76eab8fc2d 100644 (file)
@@ -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();