Re: pgsql: Do all accesses to shared buffer headers - Mailing list pgsql-committers

From Neil Conway
Subject Re: pgsql: Do all accesses to shared buffer headers
Date
Msg-id 1129160190.8718.32.camel@localhost.localdomain
Whole thread Raw
In response to Re: pgsql: Do all accesses to shared buffer headers through  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Do all accesses to shared buffer headers through
Re: pgsql: Do all accesses to shared buffer headers
List pgsql-committers
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



pgsql-committers by date:

Previous
From: tgl@svr1.postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix spelling error, per Michael Fuhr.
Next
From: tgl@svr1.postgresql.org (Tom Lane)
Date:
Subject: pgsql: Don't try to remove duplicate OR-subclauses in