Commit 8cdc0a6d authored by Jeff Trawick's avatar Jeff Trawick
Browse files

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
parent 12e80544
Loading
Loading
Loading
Loading
+4 −3
Changes for server/mpm/event/event.c: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -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
+7 −8
Changes for server/mpm/prefork/prefork.c: 7 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -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) {
+4 −3
Changes for server/mpm/worker/worker.c: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -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