Skip to content

Commit ba16aad

Browse files
committed
Switch flags tracking pending interrupts to sig_atomic_t
Those previously used bool, which should be safe on any modern platforms, however the C standard is clear that it is better to use sig_atomic_t for variables manipulated in signal handlers. This commit adds at the same time PGDLLIMPORT to ClientConnectionLost. Author: Michael Paquier Reviewed-by: Tom Lane, Chris Travers, Andres Freund Discussion: https://postgr.es/m/20180925011311.GD1354@paquier.xyz
1 parent 751f532 commit ba16aad

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/backend/utils/init/globals.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
ProtocolVersion FrontendProtocol;
2929

30-
volatile bool InterruptPending = false;
31-
volatile bool QueryCancelPending = false;
32-
volatile bool ProcDiePending = false;
33-
volatile bool ClientConnectionLost = false;
34-
volatile bool IdleInTransactionSessionTimeoutPending = false;
30+
volatile sig_atomic_t InterruptPending = false;
31+
volatile sig_atomic_t QueryCancelPending = false;
32+
volatile sig_atomic_t ProcDiePending = false;
33+
volatile sig_atomic_t ClientConnectionLost = false;
34+
volatile sig_atomic_t IdleInTransactionSessionTimeoutPending = false;
3535
volatile sig_atomic_t ConfigReloadPending = false;
3636
volatile uint32 InterruptHoldoffCount = 0;
3737
volatile uint32 QueryCancelHoldoffCount = 0;

src/include/miscadmin.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@
7777

7878
/* in globals.c */
7979
/* these are marked volatile because they are set by signal handlers: */
80-
extern PGDLLIMPORT volatile bool InterruptPending;
81-
extern PGDLLIMPORT volatile bool QueryCancelPending;
82-
extern PGDLLIMPORT volatile bool ProcDiePending;
83-
extern PGDLLIMPORT volatile bool IdleInTransactionSessionTimeoutPending;
80+
extern PGDLLIMPORT volatile sig_atomic_t InterruptPending;
81+
extern PGDLLIMPORT volatile sig_atomic_t QueryCancelPending;
82+
extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending;
83+
extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending;
8484
extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending;
8585

86-
extern volatile bool ClientConnectionLost;
86+
extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost;
8787

8888
/* these are marked volatile because they are examined by signal handlers: */
8989
extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount;

0 commit comments

Comments
 (0)