]> granicus.if.org Git - apache/commitdiff
Move wait_or_timeout from the MPM's into the new mpm_common.c file. I
authorRyan Bloom <rbb@apache.org>
Fri, 19 May 2000 01:05:26 +0000 (01:05 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 19 May 2000 01:05:26 +0000 (01:05 +0000)
also renamed wait_or_timeout to ap_wait_or_timeout for namespace
protection.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85250 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/dexter/dexter.c
server/mpm/mpmt_pthread/mpmt_pthread.c
server/mpm/prefork/prefork.c
server/mpm_common.c

index 3876ead6ced23695fd9ee088f04de741d0fac719..fb07fb1c6ce8f1b269069c108d1f4a86b18844bd 100644 (file)
@@ -180,42 +180,6 @@ static void clean_child_exit(int code)
     exit(code);
 }
 
-/* Finally, this routine is used by the caretaker process to wait for
- * a while...
- */
-
-/* number of calls to wait_or_timeout between writable probes */
-#ifndef INTERVAL_OF_WRITABLE_PROBES
-#define INTERVAL_OF_WRITABLE_PROBES 10
-#endif
-static int wait_or_timeout_counter;
-
-static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
-{
-    struct timeval tv;
-    ap_status_t rv;
-    ap_proc_t *ret = NULL;
-
-    ++wait_or_timeout_counter;
-    if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
-        wait_or_timeout_counter = 0;
-#ifdef APR_HAS_OTHER_CHILD
-        ap_probe_writable_fds();
-#endif
-    }
-    rv = ap_wait_all_procs(&ret, status, APR_NOWAIT, p);
-    if (ap_canonical_error(rv) == APR_EINTR) {
-        return NULL;
-    }
-    if (rv == APR_CHILD_DONE) {
-        return ret;
-    }
-    tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
-    tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
-    ap_select(0, NULL, NULL, NULL, &tv);
-    return NULL;
-}
-
 /* handle all varieties of core dumping signals */
 static void sig_coredump(int sig)
 {
@@ -1014,7 +978,7 @@ static void server_main_loop(int remaining_children_to_start)
     int i;
 
     while (!restart_pending && !shutdown_pending) {
-        pid = wait_or_timeout(&status, pconf);
+        pid = ap_wait_or_timeout(&status, pconf);
         
         if (pid != NULL) {
             int actual_pid;
index 7cef3c8cb63885d0829f30fc8f9d2e6dfd79507c..e8f1bf7ccef032cad1b288b867443e2295eff1d2 100644 (file)
@@ -184,47 +184,6 @@ void clean_child_exit(int code)
     exit(code);
 }
 
-/* Finally, this routine is used by the caretaker process to wait for
- * a while...
- */
-
-/* number of calls to wait_or_timeout between writable probes */
-#ifndef INTERVAL_OF_WRITABLE_PROBES
-#define INTERVAL_OF_WRITABLE_PROBES 10
-#endif
-static int wait_or_timeout_counter;
-
-static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
-{
-    struct timeval tv;
-    ap_status_t rv;
-    ap_proc_t *ret = NULL;
-
-    ++wait_or_timeout_counter;
-    if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
-        wait_or_timeout_counter = 0;
-#ifdef APR_HAS_OTHER_CHILD
-        ap_probe_writable_fds();
-#endif
-    }
-    rv = ap_wait_all_procs(&ret, status, APR_NOWAIT, p);
-    if (ap_canonical_error(rv) == APR_EINTR) {
-        return NULL;
-    }
-    if (rv == APR_CHILD_DONE) {
-        return ret;
-    }
-#ifdef NEED_WAITPID
-    if ((ret = reap_children(status)) > 0) {
-        return ret;
-    }
-#endif
-    tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
-    tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
-    ap_select(0, NULL, NULL, NULL, &tv);
-    return NULL;
-}
-
 /* handle all varieties of core dumping signals */
 static void sig_coredump(int sig)
 {
@@ -1061,7 +1020,7 @@ static void server_main_loop(int remaining_children_to_start)
 
     while (!restart_pending && !shutdown_pending) {
         /* this is a memory leak, but I'll fix it later. */
-        pid = wait_or_timeout(&status, pconf);
+        pid = ap_wait_or_timeout(&status, pconf);
         
         if (pid != NULL) {
             process_child_status(pid, status);
index e7bb515962bc46e36a59ad6f65d29bc40df32a17..458a2525799c59319720c63a94d7364fc3cb2970 100644 (file)
@@ -1051,47 +1051,6 @@ int reap_children(ap_wait_t *status)
 }
 #endif
 
-/* Finally, this routine is used by the caretaker process to wait for
- * a while...
- */
-
-/* number of calls to wait_or_timeout between writable probes */
-#ifndef INTERVAL_OF_WRITABLE_PROBES
-#define INTERVAL_OF_WRITABLE_PROBES 10
-#endif
-static int wait_or_timeout_counter;
-
-static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
-{
-    struct timeval tv;
-    ap_status_t rv;
-    ap_proc_t *ret = NULL;
-
-    ++wait_or_timeout_counter;
-    if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
-       wait_or_timeout_counter = 0;
-#ifdef APR_HAS_OTHER_CHILD
-       ap_probe_writable_fds();
-#endif
-    }
-    rv = ap_wait_all_procs(&ret, status, APR_NOWAIT, p);
-    if (ap_canonical_error(rv) == APR_EINTR) {
-       return NULL;
-    }
-    if (rv == APR_CHILD_DONE) {
-       return ret;
-    }
-#ifdef NEED_WAITPID
-    if ((ret = reap_children(status)) > 0) {
-       return ret;
-    }
-#endif
-    tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
-    tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
-    ap_select(0, NULL, NULL, NULL, &tv);
-    return NULL;
-}
-
 /* handle all varieties of core dumping signals */
 static void sig_coredump(int sig)
 {
@@ -2000,7 +1959,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s)
        int child_slot;
        ap_wait_t status;
         /* this is a memory leak, but I'll fix it later. */
-       ap_proc_t *pid = wait_or_timeout(&status, pconf);
+       ap_proc_t *pid = ap_wait_or_timeout(&status, pconf);
 
        /* XXX: if it takes longer than 1 second for all our children
         * to start up and get into IDLE state then we may spawn an
index 3201b4c72bdc60b87ef4e4e9ed2d7951bfaba2f5..a9663c3d91a12680d8fa8c6c95480be02f96130f 100644 (file)
@@ -167,4 +167,41 @@ void ap_reclaim_child_processes(int terminate)
     }
 }
 
+/* number of calls to wait_or_timeout between writable probes */
+#ifndef INTERVAL_OF_WRITABLE_PROBES
+#define INTERVAL_OF_WRITABLE_PROBES 10
+#endif
+static int wait_or_timeout_counter;
+
+static ap_proc_t *ap_wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
+{
+    struct timeval tv;
+    ap_status_t rv;
+    ap_proc_t *ret = NULL;
+
+    ++wait_or_timeout_counter;
+    if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
+        wait_or_timeout_counter = 0;
+#ifdef APR_HAS_OTHER_CHILD
+        ap_probe_writable_fds();
+#endif
+    }
+    rv = ap_wait_all_procs(&ret, status, APR_NOWAIT, p);
+    if (ap_canonical_error(rv) == APR_EINTR) {
+        return NULL;
+    }
+    if (rv == APR_CHILD_DONE) {
+        return ret;
+    }
+#ifdef NEED_WAITPID
+    if ((ret = reap_children(status)) > 0) {
+        return ret;
+    }
+#endif
+    tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
+    tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
+    ap_select(0, NULL, NULL, NULL, &tv);
+    return NULL;
+}
+