From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: unconstify equivalent for volatile |
Date: | 2019-02-22 11:38:35 |
Message-ID: | 22c4099b-2002-7a60-fb76-b02c569f3a78@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2019-02-19 18:02, Andres Freund wrote:
> Because SetLatch() is careful to have a pg_memory_barrier() before
> touching shared state and conversely so are ResetLatch() (and
> WaitEventSetWait(), which already has no volatiles). And if we've got
> this wrong they aren't safe for shared latches, because volatiles don't
> enforce meaningful ordering on weakly ordered architectures.
That makes sense.
> But even if we were to decide we'd want to keep a volatile in SetLatch()
> - which I think really would only serve to hide bugs - that'd not mean
> it's a good idea to keep it on all the other functions in latch.c.
What is even the meaning of having a volatile Latch * argument on a
function when the actual latch variable (MyLatch) isn't volatile? That
would just enforce certain constraints on the compiler inside that
function but not on the overall program, right?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2019-02-22 12:03:13 | Re: CPU costs of random_zipfian in pgbench |
Previous Message | Oleksii Kliukin | 2019-02-22 11:17:01 | Re: Prepared transaction releasing locks before deregistering its GID |