Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()
Date: 2020-05-25 14:10:43
Message-ID: ecc446ea-07d8-537d-9341-27be592956aa@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/25/20 9:52 AM, Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-05-25 14:37:36 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Tom Lane 2020-05-25 13:52:13 Re: repeat() function, CHECK_FOR_INTERRUPTS(), and unlikely()