]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Refactor CHECK_FOR_INTERRUPTS() to add flexibility.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 14 May 2021 16:54:26 +0000 (12:54 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 14 May 2021 16:54:26 +0000 (12:54 -0400)
commit39b8ccb08619cb3e4c97d90134fcb7fb48c79bac
treec798f42caa2f024763a08ea68345683d1291011b
parentb5b7cba7643ca96f0ff882e643ee1ebd8c86003a
Refactor CHECK_FOR_INTERRUPTS() to add flexibility.

Split up CHECK_FOR_INTERRUPTS() to provide an additional macro
INTERRUPTS_PENDING_CONDITION(), which just tests whether an
interrupt is pending without attempting to service it.  This is
useful in situations where the caller knows that interrupts are
blocked, and would like to find out if it's worth the trouble
to unblock them.

Also add INTERRUPTS_CAN_BE_PROCESSED(), which indicates whether
CHECK_FOR_INTERRUPTS() can be relied on to clear the pending interrupt.

This commit doesn't actually add any uses of the new macros,
but a follow-on bug fix will do so.  Back-patch to all supported
branches to provide infrastructure for that fix.

Alvaro Herrera and Tom Lane

Discussion: https://postgr.es/m/20210513155351.GA7848@alvherre.pgsql
src/backend/tcop/postgres.c
src/include/miscadmin.h