From: Tatsuo Ishii Date: Tue, 16 May 2017 10:59:56 +0000 (+0900) Subject: Use volatile pointer for Req_info variable. X-Git-Tag: V3_4_12~8 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5a3d3964e67e1e1e3826d17f1e56f518c701008d;p=pgpool2.git Use volatile pointer for Req_info variable. Since Req_info points to shared memory area, using volatile pointer will allow to fetch the fresh value. --- diff --git a/src/include/pool.h b/src/include/pool.h index f618435bf..e8432eb03 100644 --- a/src/include/pool.h +++ b/src/include/pool.h @@ -490,7 +490,7 @@ extern int my_proc_id; /* process table id (!= UNIX's PID) */ extern POOL_SYSTEMDB_CONNECTION_POOL *system_db_info; /* systemdb */ extern ProcessInfo *process_info; /* shmem process information table */ extern ConnectionInfo *con_info; /* shmem connection info table */ -extern POOL_REQUEST_INFO *Req_info; +extern volatile POOL_REQUEST_INFO *Req_info; extern volatile sig_atomic_t *InRecovery; extern char remote_ps_data[]; /* used for set_ps_display */ extern volatile sig_atomic_t got_sighup; diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index bf10f9ce0..ef4a4395d 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -158,7 +158,7 @@ extern char hba_file[POOLMAXPATHLEN+1]; static int exiting = 0; /* non 0 if I'm exiting */ static int switching = 0; /* non 0 if I'm fail overing or degenerating */ -POOL_REQUEST_INFO *Req_info; /* request info area in shared memory */ +volatile POOL_REQUEST_INFO *Req_info; /* request info area in shared memory */ volatile sig_atomic_t *InRecovery; /* non 0 if recovery is started */ volatile sig_atomic_t reload_config_request = 0; static volatile sig_atomic_t failover_request = 0; diff --git a/src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c b/src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c index 5f12a2342..993a9cd10 100644 --- a/src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c +++ b/src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c @@ -9,7 +9,7 @@ /* for get_current_timestamp() (MASTER() macro) */ POOL_REQUEST_INFO _req_info; -POOL_REQUEST_INFO *Req_info = &_req_info; +volatile POOL_REQUEST_INFO *Req_info = &_req_info; POOL_CONFIG _pool_config; POOL_CONFIG *pool_config = &_pool_config; ProcessType processType;