Re: pgsql: Add pg_atomic_unlocked_write_u64

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Nathan Bossart <nathandbossart@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-12-04T18:15:55Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> How about:

> /*
>  * pg_atomic_unlocked_write_u32 - unlocked write to atomic variable.
>  *
>  * Write to an atomic variable, without atomicity guarantees. I.e. it is not
>  * guaranteed that a concurent reader will not see a torn value, nor to

grammar police: s/nor to/nor is this/

>  * guaranteed to correctly interact with concurrent read-modify-write
>  * operations like pg_atomic_compare_exchange_u32.  This should only be used
>  * in cases where minor performance regressions due to atomic operations are
>  * unacceptable and where exclusive access is guaranteed due to some external
>  * means.
>  *
>  * No barrier semantics.
>  */

LGTM otherwise.

			regards, tom lane



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve documentation for pg_atomic_unlocked_write_u32()

  2. Add pg_atomic_unlocked_write_u64