Re: small cleanup for s_lock.h

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: small cleanup for s_lock.h
Date: 2026-05-07 21:28:09
Message-ID: af0D6fhLfVmG2fr7@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 07, 2026 at 04:12:09PM -0500, Nathan Bossart wrote:
> On Thu, May 07, 2026 at 03:41:56PM -0500, Nathan Bossart wrote:
>> +/*
>> + * We can only define TAS_SPIN if TAS was defined. Otherwise, the platform
>> + * defined its own S_LOCK without TAS, and therefore is responsible for
>> + * defining its own TAS_SPIN as well. (Note that we currently do not have any
>> + * platforms that don't define TAS.)
>> + */
>> #if !defined(TAS_SPIN)
>> +#if defined(TAS)
>> #define TAS_SPIN(lock) TAS(lock)
>> -#endif /* TAS_SPIN */
>> +#else
>> +#error Neither TAS nor TAS_SPIN defined on this platform. Please report this to pgsql-bugs(at)lists(dot)postgresql(dot)org(dot)
>> +#endif /* TAS */
>> +#endif /* ! TAS_SPIN */
>
> Wait, this isn't right. TAS_SPIN is only used by s_lock(), which is only
> used by the default S_LOCK. We should just not compile s_lock() if the
> platform defines its own S_LOCK, and we shouldn't #error here if TAS is not
> defined.

Should be fixed in v5, sorry for the noise.

--
nathan

Attachment Content-Type Size
v5-0001-Remove-fallback-declaration-for-tas.patch text/plain 2.2 KB
v5-0002-Remove-HAS_TEST_AND_SET.patch text/plain 3.2 KB
v5-0003-Better-express-platform-requirements-in-s_lock.h.patch text/plain 5.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2026-05-07 21:44:45 Re: Fix typo 586/686 in atomics/arch-x86.h
Previous Message Nathan Bossart 2026-05-07 21:12:09 Re: small cleanup for s_lock.h