From 3b75c2651668fcf6d395a28a564c6c3b8166cb1d Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Fri, 4 Mar 2011 22:12:21 +0000 Subject: [PATCH] sanity check use of volatile in prefork, worker, and event git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1078170 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/event/event.c | 7 ++++--- server/mpm/prefork/prefork.c | 15 +++++++-------- server/mpm/worker/worker.c | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 18e9ad22ef..21d0d16b7c 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -170,7 +170,7 @@ static fd_queue_t *worker_queue; static fd_queue_info_t *worker_queue_info; static int mpm_state = AP_MPMQ_STARTING; static int sick_child_detected; -static ap_generation_t volatile my_generation = 0; +static ap_generation_t my_generation = 0; static apr_thread_mutex_t *timeout_mutex; APR_RING_HEAD(timeout_head_t, conn_state_t); @@ -443,11 +443,12 @@ static void just_die(int sig) * Connection structures and accounting... */ -/* volatile just in case */ +static int child_fatal; + +/* volatile because they're updated from a signal handler */ static int volatile shutdown_pending; static int volatile restart_pending; static int volatile is_graceful; -static volatile int child_fatal; /* * ap_start_shutdown() and ap_start_restart(), below, are a first stab at diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 7bac60d66b..ebc36c6ccb 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -133,9 +133,7 @@ static apr_pool_t *pchild; /* Pool for httpd child stuff */ static pid_t ap_my_pid; /* it seems silly to call getpid all the time */ static pid_t parent_pid; static int my_child_num; -static ap_generation_t volatile my_generation=0; - -static volatile int die_now = 0; +static ap_generation_t my_generation=0; #ifdef GPROF /* @@ -316,6 +314,12 @@ static void just_die(int sig) clean_child_exit(0); } +/* volatile because they're updated from a signal handler */ +static int volatile shutdown_pending; +static int volatile restart_pending; +static int volatile is_graceful; +static int volatile die_now = 0; + static void stop_listening(int sig) { mpm_state = AP_MPMQ_STOPPING; @@ -325,11 +329,6 @@ static void stop_listening(int sig) die_now = 1; } -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; - static void sig_term(int sig) { if (shutdown_pending == 1) { diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 07ecc7c28f..299ed1d763 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -133,7 +133,7 @@ static fd_queue_t *worker_queue; static fd_queue_info_t *worker_queue_info; static int mpm_state = AP_MPMQ_STARTING; static int sick_child_detected; -static ap_generation_t volatile my_generation = 0; +static ap_generation_t my_generation = 0; /* data retained by worker across load/unload of the module * allocated on first call to pre-config hook; located on @@ -390,11 +390,12 @@ static void just_die(int sig) * Connection structures and accounting... */ -/* volatile just in case */ +static int child_fatal; + +/* volatile because they're updated from a signal handler */ static int volatile shutdown_pending; static int volatile restart_pending; static int volatile is_graceful; -static volatile int child_fatal; /* * ap_start_shutdown() and ap_start_restart(), below, are a first stab at -- 2.50.1