Re: Trying out <stdatomic.h>

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Trying out <stdatomic.h>
Date: 2025-11-10 13:57:03
Message-ID: 536409d2-c9df-4ef3-808d-1ffc3182868c@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/11/2025 15:17, Thomas Munro wrote:
> Hi,
>
> Here is an experimental patch to try out standard C (and C++) atomics
> to implement port/atomics.h, and also add more types and operations.
> It's mostly just redirecting our names to the standard ones, except
> for our barriers and slightly extended pg_atomic_flag, so there isn't
> much left of the code.

> 9 files changed, 166 insertions(+), 1824 deletions(-)
> ...
> 8 files changed, 176 insertions(+), 881 deletions(-)
> ...
> 7 files changed, 1 insertion(+), 394 deletions(-)

Nice!

> [PATCH v1 1/4] Add some missing #include <limits.h>.

This seems like a good thing regardless of the other patches.

The "#include <limits.h>" lines in src/backend/lib/dshash.c and
src/backend/storage/lmgr/condition_variable.c are slightly misplaced:
system headers should be included between "postgres.h" and other
postgres headers.

> Here also is a semi-independent patch to implement storage/spin.h with
> pg_atomic_flag. It keeps a small amount of the architecture-specific
> magic, but moves it out to src/port/spin_delay.h.

Makes sense.

The patch removes 'src/template/solaris'. Is that on purpose? Is that an
independent cleanup that could be committed immediately?

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-11-10 14:14:02 Re: Add tests for object size limits of injection points
Previous Message Chao Li 2025-11-10 13:53:52 Re: Minor adjustment: Update the range of the commit_siblings parameter.