Add unlikely() to CHECK_FOR_INTERRUPTS()
authorJoe Conway <[email protected]>
Fri, 5 Jun 2020 20:49:35 +0000 (16:49 -0400)
committerJoe Conway <[email protected]>
Fri, 5 Jun 2020 20:49:35 +0000 (16:49 -0400)
Add the unlikely() branch hint macro to CHECK_FOR_INTERRUPTS().
Backpatch to REL_10_STABLE where we first started using unlikely().

Discussion: https://www.postgresql.org/message-id/flat/8692553c-7fe8-17d9-cbc1-7cddb758f4c6%40joeconway.com

src/include/miscadmin.h

index e76b4b9bb95f6418919d57ec0caf3fb54fa2db1b..7b945bb18a0f6af1bc6307f6986b92b37f94effe 100644 (file)
@@ -97,16 +97,16 @@ extern void ProcessInterrupts(void);
 
 #define CHECK_FOR_INTERRUPTS() \
 do { \
-   if (InterruptPending) \
+   if (unlikely(InterruptPending)) \
        ProcessInterrupts(); \
 } while(0)
 #else                          /* WIN32 */
 
 #define CHECK_FOR_INTERRUPTS() \
 do { \
-   if (UNBLOCKED_SIGNAL_QUEUE()) \
+   if (unlikely(UNBLOCKED_SIGNAL_QUEUE())) \
        pgwin32_dispatch_queued_signals(); \
-   if (InterruptPending) \
+   if (unlikely(InterruptPending)) \
        ProcessInterrupts(); \
 } while(0)
 #endif                         /* WIN32 */