public inbox for [email protected]
help / color / mirror / Atom feedFrom: 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 11:08:38 -0500
Message-ID: <afoWBgsygtkCNCRQ@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 noticed that s_lock.h points to a default implementation of tas() in
>> tas.s or s_lock.c, but AFAICT there hasn't been a tas() implementation in
>> s_lock.c since commit 718aa43a4e, and commit 25f36066dd seems to have
>> removed the last remaining tas.s files. So, I think this is dead code.
>
> It is, but I think the 0001 patch should be more like
>
> #if !defined(TAS)
> -extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or
> - * s_lock.c */
> -
> -#define TAS(lock) tas(lock)
> +#error "must provide a spinlock implementation"
> #endif /* TAS */
>
> Perhaps this could be merged with the earlier bit about erroring
> if not HAS_TEST_AND_SET.
>
>> I also noticed that HAS_TEST_AND_SET just means that TAS is defined, so I
>> wrote a 0002 that removes it in favor of checking TAS directly.
>
> I'm pretty much -1 on that; HAS_TEST_AND_SET is clearer than TAS, and
> removing it seems quite likely to break someone's code. We could
> perhaps collect all the separate instances into this end location:
>
> #if defined(TAS)
> #define HAS_TEST_AND_SET
> #else
> #error "must provide a spinlock implementation"
> #endif /* TAS */
Okay, here's a new version of the patch that I believe addresses both
points.
--
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: <afoWBgsygtkCNCRQ@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