| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Greg Burd <greg(at)burd(dot)me> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Trying out <stdatomic.h> |
| Date: | 2026-10-21 00:56:45 |
| Message-ID: | CAGRkXqS5cDNNVwLfqpGGe2ozYTCRUNcRErzX4F4h6sXufsLx8A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Greg,
I'm not an expert on atomics, but I tried v8-0001 on macOS arm64 with
-Duse_stdatomic=yes. The full meson suite passes. Two things came up.
1. The header has a C++23 branch, and that branch fails to build
when an extension includes it inside extern "C", which is the usual
way:
extern "C" {
#include "postgres.h"
#include "storage/lwlock.h"
}
clang 17 failed with "templates must have C++ linkage".
2. pg_atomic_test_set_flag_impl uses atomic_fetch_and_explicit(). On
x86 clang turns that into a lock cmpxchg loop, while master uses a
single xchg.
Maybe use atomic_exchange_explicit(ptr, 0, memory_order_acquire) ?
Thanks,
Shihao
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-21 01:06:55 | Re: Improving scalability of Parallel Bitmap Heap/Index Scan |
| Previous Message | Michael Paquier | 2026-10-21 00:48:29 | Re: pgstat: don't assert on dropped entries when writing stats file |