Re: spinlocks on HP-UX - Mailing list pgsql-hackers

From Greg Stark
Subject Re: spinlocks on HP-UX
Date
Msg-id CAM-w4HNkj-Snn2jud-Au2vy-d+35YF1td7MFsXeD+M3Yahyq+g@mail.gmail.com
Whole thread Raw
In response to Re: spinlocks on HP-UX  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: spinlocks on HP-UX
List pgsql-hackers
On Mon, Aug 29, 2011 at 4:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>  *      ANOTHER CAUTION: be sure that TAS(), TAS_SPIN(), and
>> S_UNLOCK() represent
>>  *      sequence points, ie, loads and stores of other values must not be moved
>>  *      across a lock or unlock.  In most cases it suffices to make
>> the operation
>>  *      be done through a "volatile" pointer.
>
>> IIUC, this is basically total nonsense.
>
> It could maybe be rewritten for more clarity, but it's far from being
> nonsense.

The confusion for me is that it's talking about sequence points and
volatile pointers in the same breath as if one implies the other.
Making something a volatile pointer dose not create a sequence point.
It requires that the compiler not move the access or store across any
sequence points that are already there.

It might be helpful to include the actual bug that the comment is
trying to warn against because iirc it was a real case that caused you
to add the volatile modifiers.

--
greg


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: spinlocks on HP-UX
Next
From: Tom Lane
Date:
Subject: Re: spinlocks on HP-UX