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

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

Joe Conway <mail(at)joeconway(dot)com> writes:
> On 5/25/20 9:52 AM, Tom Lane wrote:
>> There was some question as to what (if anything) to do with the Windows
>> version of CHECK_FOR_INTERRUPTS. Have you resolved that?

> 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.

Perhaps I'm an optimist, but I think that eventually we will figure out
how to make unlikely() work for MSVC. In the meantime we might as well
let it work for gcc-on-Windows builds.

> 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.

I think that each of those tests should have a separate unlikely() marker,
since the whole point here is that we don't expect either of those tests
to yield true in the huge majority of CHECK_FOR_INTERRUPTS executions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2020-05-25 15:18:49 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Dilip Kumar 2020-05-25 14:37:49 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions