#include "http_connection.h"
#include "ap_mpm.h"
#include "mpm_common.h"
+#include "pod.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include "mpm_default.h"
static worker_stack *idle_worker_stack;
#define ST_INIT 0
-#define ST_RESTART 0
#define ST_GRACEFUL 1
#define ST_UNGRACEFUL 2
/* see if termination was triggered while we slept */
switch(terminate_mode) {
case ST_GRACEFUL:
- rv = ST_GRACEFUL;
+ rv = AP_GRACEFUL;
break;
case ST_UNGRACEFUL:
- rv = ST_RESTART;
+ rv = AP_RESTART;
break;
}
}
- if (rv == ST_GRACEFUL || rv == ST_RESTART) {
- /* make sure the start thread has finished;
- * signal_threads() and join_workers depend on that
- */
- join_start_thread(start_thread_id);
- signal_threads(rv == ST_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
- break;
- }
}
- if (rv == ST_GRACEFUL) {
- /* A terminating signal was received. Now join each of the
- * workers to clean them up.
- * If the worker already exited, then the join frees
- * their resources and returns.
- * If the worker hasn't exited, then this blocks until
- * they have (then cleans up).
- */
- join_workers(threads);
- }
+ signal_threads(ST_GRACEFUL);
+ /* A terminating signal was received. Now join each of the
+ * workers to clean them up.
+ * If the worker already exited, then the join frees
+ * their resources and returns.
+ * If the worker hasn't exited, then this blocks until
+ * they have (then cleans up).
+ */
+ join_workers(threads);
}
free(threads);
if (idle_thread_count > max_spare_threads) {
/* Kill off one child */
- ap_mpm_pod_signal(pod);
+ ap_mpm_pod_signal(pod, TRUE);
idle_spawn_rate = 1;
}
else if (idle_thread_count < min_spare_threads) {
* (By "gracefully" we don't mean graceful in the same sense as
* "apachectl graceful" where we allow old connections to finish.)
*/
- ap_mpm_pod_killpg(pod, ap_daemons_limit);
+ ap_mpm_pod_killpg(pod, ap_daemons_limit, FALSE);
ap_reclaim_child_processes(1); /* Start with SIGTERM */
if (!child_fatal) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
AP_SIG_GRACEFUL_STRING " received. Doing graceful restart");
/* wake up the children...time to die. But we'll have more soon */
- ap_mpm_pod_killpg(pod, ap_daemons_limit);
+ ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
/* This is mostly for debugging... so that we know what is still
* and a SIGHUP, we may as well use the same signal, because some user
* pthreads are stealing signals from us left and right.
*/
- ap_mpm_pod_killpg(pod, ap_daemons_limit);
+ ap_mpm_pod_killpg(pod, ap_daemons_limit, FALSE);
ap_reclaim_child_processes(1); /* Start with SIGTERM */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,