On Wed, 2005-12-10 at 18:54 -0400, Tom Lane wrote:
> How would a typedef make it safer?  I see no particular difference
> between omitting the "volatile" and choosing the wrong typedef.

IMHO it is notationally clearer to define a "BufferDescPtr" that
contains the "volatile" qualifier than to make sure that "volatile" is
used everywhere that it is needed -- obviously, neither approach is
fool-proof. But perhaps that's just me...

> We do however have here a New Coding Rule that's good for all parts
> of the backend: if you are accessing a spinlock-protected data structure
> then you should be using a volatile-qualified pointer for it.

I think this is worth documenting more clearly (I realize you added a
note in buf_internals.h, but perhaps a note in the spinlock headers
would be appropriate as well? The comment circa line 49 of s_lock.h
seems to need updating, for example.)

-Neil



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to