Hi,

On 2026-10-09 05:57:52 +0000, Bertrand Drouvot wrote:
> +  pg_memory_barrier();
> +
> +  completions = pg_atomic_read_u64(&TransamVariables->xactCompletionCount);
> 
> IIUC, the barriers order the surrounding memory accesses, but they do not 
> guarantee
> that pg_atomic_read_u64() does not return an old value.

I do not believe that that is true. Except in the sense of allowing an update
to the atomic variable having happened between pg_memory_barrier() and the
pg_atomic_read_u64(), but that's something that is indistinguishable from the
increment happening happeng just after pg_atomic_read_membarrier_u64().

Greetings,

Andres Freund


Reply via email to