public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: small cleanup for s_lock.h
Date: Tue, 5 May 2026 10:49:30 -0500
Message-ID: <afoRiqyHl0HxhzCB@nathan> (raw)
In-Reply-To: <[email protected]>
References: <afkUeI7UhacZ5ZFm@nathan>
	<[email protected]>

On Mon, May 04, 2026 at 06:16:47PM -0400, Tom Lane wrote:
> Nathan Bossart <[email protected]> writes:
>> I'd like to rewrite the comment at the top of the file, too, but haven't
>> gotten to that yet.  I find it a little misleading, especially because
>> we #error if TAS isn't defined.
> 
> No objection in principle to improving that comment, but what did you
> have in mind exactly?

I think the way the comment presents the macros gives a potentially
misleading impression about what you typically need to do to get a new
platform working, and you basically need to read through the whole file to
make sense of what's going on.  Some of the macros it mentions have a
default implementation that we use everywhere (e.g., S_INIT_LOCK), and if
you're using gcc, you may be able to just use the __sync_lock_test_and_set
versions.  If you _did_ need to add a new section for a new platform, you'd
probably be more interested in defining slock_t, HAS_TEST_AND_TEST/TAS,
S_UNLOCK, SPIN_DELAY, and maybe TAS_SPIN.  In fact, you _must_ ensure TAS
is defined or else we'll fail to compile.

Although as I write this e-mail and think about how exactly I'd rewrite the
comment, I grow less confident about doing so...

-- 
nathan





view thread (12+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: small cleanup for s_lock.h
  In-Reply-To: <afoRiqyHl0HxhzCB@nathan>

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

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