pgpool2.git / summary / log / commit / refs

commit    a4de4bfc1421d787b53789eb62eb7e9cb26e91c1
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Tue May 16 10:59:56 2017 +0000

    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.


src/include/pool.h | 2 +- src/main/pgpool_main.c | 2 +- src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/pool.h b/src/include/pool.h index d5dd63aa8..056c2c0af 100644 --- a/src/include/pool.h +++ b/src/include/pool.h @@ -500,7 +500,7 @@ extern long int weight_master; /* normalized weight of master (0-RAND_MAX range) extern int my_proc_id; /* process table id (!= UNIX's PID) */ 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 a3f5d76e4..928f5aa5a 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -177,7 +177,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 failing over 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 sigusr1_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 e62060fc9..898d21707 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; [parent: 81228a019cc8]