Do not accept interrupts in RESUME_INTERRUPTS() and END_CRIT_SECTION()
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 Jan 2002 23:16:22 +0000 (23:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 Jan 2002 23:16:22 +0000 (23:16 +0000)
macros, but only at explicit CHECK_FOR_INTERRUPTS() calls.  Not clear
whether overenthusiastic acceptance of interrupts accounts for any real
bugs, but it definitely seems risky and unnecessary.

src/backend/tcop/postgres.c
src/include/miscadmin.h

index d398f256dac897d3a93702262c81f968664f3fbb..a2b097052c43243e9f29b7888f14be4af3e373f6 100644 (file)
@@ -1626,7 +1626,7 @@ PostgresMain(int argc, char *argv[], const char *username)
        if (!IsUnderPostmaster)
        {
                puts("\nPOSTGRES backend interactive interface ");
-               puts("$Revision: 1.243 $ $Date: 2001/12/04 19:40:17 $\n");
+               puts("$Revision: 1.244 $ $Date: 2002/01/01 23:16:22 $\n");
        }
 
        /*
@@ -1703,7 +1703,6 @@ PostgresMain(int argc, char *argv[], const char *username)
 
                /*
                 * Exit interrupt holdoff section we implicitly established above.
-                * (This could result in accepting a cancel or die interrupt.)
                 */
                RESUME_INTERRUPTS();
        }
index ff2e4c8922146ff1ebb5f7be6aa102b65289aeac..24f3b57cc640eb011cc45fdfd95d94e98556264d 100644 (file)
@@ -43,7 +43,8 @@
  * or die interrupt.  The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros
  * allow code to ensure that no cancel or die interrupt will be accepted,
  * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine. The interrupt
- * will be held off until the last matching RESUME_INTERRUPTS() occurs.
+ * will be held off until CHECK_FOR_INTERRUPTS() is done outside any
+ * HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section.
  *
  * Special mechanisms are used to let an interrupt be accepted when we are
  * waiting for a lock or when we are waiting for command input (but, of
@@ -85,8 +86,6 @@ extern void ProcessInterrupts(void);
        do { \
                Assert(InterruptHoldoffCount > 0); \
                InterruptHoldoffCount--; \
-               if (InterruptPending) \
-                       ProcessInterrupts(); \
        } while(0)
 
 #define START_CRIT_SECTION()  (CritSectionCount++)
@@ -95,8 +94,6 @@ extern void ProcessInterrupts(void);
        do { \
                Assert(CritSectionCount > 0); \
                CritSectionCount--; \
-               if (InterruptPending) \
-                       ProcessInterrupts(); \
        } while(0)