Re: spinlocks on HP-UX

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: spinlocks on HP-UX
Дата
Msg-id CAM-w4HNkj-Snn2jud-Au2vy-d+35YF1td7MFsXeD+M3Yahyq+g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: spinlocks on HP-UX  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: spinlocks on HP-UX  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: spinlocks on HP-UX
Следующее
От: Tom Lane
Дата:
Сообщение: Re: spinlocks on HP-UX