pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Better express platform requirements in s_lock.h.
Date: Mon, 28 Sep 2026 18:53:00 +0000
Message-ID: <E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org> (raw)

Better express platform requirements in s_lock.h.

Presently, s_lock.h insists that every platform provide TAS(), and
its header comment doesn't say which of the macros a new platform
actually needs to supply.  The real contract is that a platform
must provide either S_LOCK() or a TAS() for the default S_LOCK() to
be built on.

To better express that, this commit moves the "no spinlock support"
error to where the default S_LOCK() is defined, compiles s_lock()
only when the default S_LOCK() is in use, and provides a default
TAS_SPIN() only when there is a TAS() to base it on.  The direct
callers of s_lock() in the spinlock tests are adjusted to match.
The header comment is reworked accordingly, dropping the note about
pre-9.5 volatile requirements and the caution about TAS()
spuriously failing along the way.

Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/afkUeI7UhacZ5ZFm%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d9b5a63f49d9d372a6609243eb0e9417a0a35e6f

Modified Files
--------------
src/backend/storage/lmgr/s_lock.c |  4 +++-
src/include/storage/s_lock.h      | 46 +++++++++++++++++++--------------------
src/test/regress/regress.c        |  2 +-
3 files changed, 26 insertions(+), 26 deletions(-)



Message-ID: <E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org>
Permalink:  ../E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org
  Subject: Re: pgsql: Better express platform requirements in s_lock.h.
  In-Reply-To: <E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org>
  References: <E1xBGTE-00000001eFU-0Jju@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox