#define SAFE_ACCEPT(stmt) (stmt)
#endif
+static signal_workers(void)
+{
+ workers_may_exit = 1;
+ ap_queue_signal_all_wakeup(worker_queue);
+}
+
AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
{
switch(query_code){
static void check_infinite_requests(void)
{
if (ap_max_requests_per_child) {
- workers_may_exit = 1;
+ signal_workers();
}
else {
/* wow! if you're executing this code, you may have set a record.
/* Sets workers_may_exit if we received a character on the pipe_of_death */
static void check_pipe_of_death(void)
{
+fprintf(stderr, "looking at pipe of death\n");
apr_lock_acquire(pipe_of_death_mutex);
if (!workers_may_exit) {
apr_status_t ret;
else {
/* It won the lottery (or something else is very
* wrong). Embrace death with open arms. */
- workers_may_exit = 1;
+ signal_workers();
}
}
apr_lock_release(pipe_of_death_mutex);
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
"apr_lock_acquire failed. Attempting to shutdown "
"process gracefully.");
- workers_may_exit = 1;
+ signal_workers();
}
while (!workers_may_exit) {
* circumstances. Let's try exiting gracefully, for now. */
ap_log_error(APLOG_MARK, APLOG_ERR, ret, (const server_rec *)
ap_server_conf, "apr_poll: (listen)");
- workers_may_exit = 1;
+ signal_workers();
}
if (workers_may_exit) break;
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
"apr_lock_release failed. Attempting to shutdown "
"process gracefully.");
- workers_may_exit = 1;
+ signal_workers();
}
if (csd != NULL) {
ap_queue_push(worker_queue, csd, ptrans);
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
"apr_lock_release failed. Attempting to shutdown "
"process gracefully.");
- workers_may_exit = 1;
+ signal_workers();
}
break;
}
apr_signal_thread(check_signal);
- workers_may_exit = 1; /* helps us terminate a little more quickly when
+ signal_workers(); /* helps us terminate a little more quickly when
* the dispatch of the signal thread
* beats the Pipe of Death and the browsers
*/