8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.163 2005/08/20 23:26:24 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.164 2005/09/19 17:21:47 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -78,6 +78,7 @@ static bool waitingForLock = false;
78
78
/* Mark these volatile because they can be changed by signal handler */
79
79
static volatile bool statement_timeout_active = false;
80
80
static volatile bool deadlock_timeout_active = false;
81
+ volatile bool cancel_from_timeout = false;
81
82
82
83
/* statement_fin_time is valid only if statement_timeout_active is true */
83
84
static struct timeval statement_fin_time ;
@@ -1058,6 +1059,7 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
1058
1059
Assert (!deadlock_timeout_active );
1059
1060
statement_fin_time = fin_time ;
1060
1061
statement_timeout_active = true;
1062
+ cancel_from_timeout = false;
1061
1063
}
1062
1064
else if (statement_timeout_active )
1063
1065
{
@@ -1128,14 +1130,18 @@ disable_sig_alarm(bool is_statement_timeout)
1128
1130
MemSet (& timeval , 0 , sizeof (struct itimerval ));
1129
1131
if (setitimer (ITIMER_REAL , & timeval , NULL ))
1130
1132
{
1131
- statement_timeout_active = deadlock_timeout_active = false;
1133
+ statement_timeout_active = false;
1134
+ cancel_from_timeout = false;
1135
+ deadlock_timeout_active = false;
1132
1136
return false;
1133
1137
}
1134
1138
#else
1135
1139
/* BeOS doesn't have setitimer, but has set_alarm */
1136
1140
if (set_alarm (B_INFINITE_TIMEOUT , B_PERIODIC_ALARM ) < 0 )
1137
1141
{
1138
- statement_timeout_active = deadlock_timeout_active = false;
1142
+ statement_timeout_active = false;
1143
+ cancel_from_timeout = false;
1144
+ deadlock_timeout_active = false;
1139
1145
return false;
1140
1146
}
1141
1147
#endif
@@ -1146,7 +1152,10 @@ disable_sig_alarm(bool is_statement_timeout)
1146
1152
1147
1153
/* Cancel or reschedule statement timeout */
1148
1154
if (is_statement_timeout )
1155
+ {
1149
1156
statement_timeout_active = false;
1157
+ cancel_from_timeout = false;
1158
+ }
1150
1159
else if (statement_timeout_active )
1151
1160
{
1152
1161
if (!CheckStatementTimeout ())
@@ -1179,6 +1188,7 @@ CheckStatementTimeout(void)
1179
1188
{
1180
1189
/* Time to die */
1181
1190
statement_timeout_active = false;
1191
+ cancel_from_timeout = true;
1182
1192
kill (MyProcPid , SIGINT );
1183
1193
}
1184
1194
else
0 commit comments