Re: Trying out <stdatomic.h>

From: Greg Burd <greg(at)burd(dot)me>
To: pgsql-hackers(at)postgresql(dot)org
Cc: zhong950419(at)gmail(dot)com, greg(at)burd(dot)me, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Trying out <stdatomic.h>
Date: 2026-10-22 16:29:37
Message-ID: ato3Ogzf9gE5h7vp@floki
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 21 Oct 2026 23:54:40 -0400, shihao zhong <zhong950419(at)gmail(dot)com> wrote:
> Hi Greg,

Hi Shihao,

> One new thing. It looks like part of 0003 moved into 0001 in this
> rebase. In v9-0001, the autoconf and meson builds no longer read the
> stdatomic option and always define USE_STDATOMIC_H.
>
> So 0001 is not opt-in anymore, and a target without lock-free 64-bit
> atomics now fails at configure. The commit message still says the
> default is "no".

You're right, thanks.

v10 attached (rebased on 2786d605715) puts it back where it belongs:

- 0001 reads the option again in both build systems, default 'no'. The
lock-free requirement now lives *inside* the probe, so a target whose
64-bit atomics are lock-emulated just fails detection and keeps the
traditional implementation instead of erroring out. Only
--with-stdatomic=yes / -Duse_stdatomic=yes errors, and only because
you asked for it explicitly.
- 0003 does the option removal and the unconditional USE_STDATOMIC_H,
as it should.
- The configure.ac help text and comment said the default was 'auto'
while the code said 'no'; now both say 'no'.

best.

-greg

Attachment Content-Type Size
v10-0002-NOT-FOR-MERGE-Add-atomics-benchmark-harness.patch text/plain 91.1 KB
v10-0003-NOT-FOR-MERGE.-yet.-Remove-traditional-atomics-u.patch_ text/plain 104.3 KB
v10-0001-Add-an-opt-in-C11-stdatomic.h-implementation-of-.patch text/plain 67.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-10-22 16:34:35 Re: [PG19] A canceled notify read leaves the NOTIFY queue stuck
Previous Message Manu 2026-10-22 15:50:55 Re: json/jsonb cleanup + FmgrInfo caching