Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely() - Mailing list pgsql-hackers

From Joe Conway
Subject Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()
Date
Msg-id ecc446ea-07d8-537d-9341-27be592956aa@joeconway.com
Whole thread Raw
In response to Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()
List pgsql-hackers
On 5/25/20 9:52 AM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>>> Comments or objections?
>
>> Seeing none ... I intend to backpatch and push these two patches in the next day
>> or so.
>
> There was some question as to what (if anything) to do with the Windows
> version of CHECK_FOR_INTERRUPTS.  Have you resolved that?


Relevant hunk:

*************** do { \
*** 107,113 ****
  do { \
      if (UNBLOCKED_SIGNAL_QUEUE()) \
          pgwin32_dispatch_queued_signals(); \
!     if (InterruptPending) \
          ProcessInterrupts(); \
  } while(0)
  #endif                            /* WIN32 */
--- 107,113 ----
  do { \
      if (UNBLOCKED_SIGNAL_QUEUE()) \
          pgwin32_dispatch_queued_signals(); \
!     if (unlikely(InterruptPending)) \
          ProcessInterrupts(); \
  } while(0)
  #endif                            /* WIN32 */


Two questions.

First, as I understand it, unlikely() is a gcc thing, so it does nothing at all
for MSVC builds of Windows, which presumably are the predominate ones. The
question here is whether it is worth doing at all for Windows builds. On the
other hand it seems unlikely to harm anything, so I think it is reasonable to
leave the patch as is in that respect.

The second question is whether UNBLOCKED_SIGNAL_QUEUE() warrants its own
likely() or unlikely() wrapper. I have no idea, but we could always add that
later if someone deems it worthwhile.

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()
Next
From: Dilip Kumar
Date:
Subject: Re: PATCH: logical_work_mem and logical streaming of largein-progress transactions