Re: spinlocks on HP-UX
От | Tom Lane |
---|---|
Тема | Re: spinlocks on HP-UX |
Дата | |
Msg-id | 22545.1314633608@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: spinlocks on HP-UX (Greg Stark <stark@mit.edu>) |
Ответы |
Re: spinlocks on HP-UX
|
Список | pgsql-hackers |
Greg Stark <stark@mit.edu> writes: > 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. Well, no, I don't think that's the useful way to think about it. Modern compilers seem to only honor sequence points in terms of the semantics seen by the executing program; they don't believe that they can't reorder loads/stores freely. And as long as the memory in question is only used by the given program, they're right. But for memory locations shared with other threads of execution, you have to be careful about the order of accesses to those locations. My understanding of "volatile" is that the compiler is forbidden from altering the order of volatile-qualified loads and stores *relative to each other*, or from optimizing away a load or store that seems redundant in the context of the given program. That's got nothing to do with sequence points per se. > 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. Well, if there were one and only one bug involved here, it wouldn't be such a critical problem ... regards, tom lane
В списке pgsql-hackers по дате отправления: