1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Do all accesses to shared buffer headers through volatile-qualified

pointers, to ensure that compilers won't rearrange accesses to occur
while we're not holding the buffer header spinlock.  It's probably
not necessary to mark volatile in every single place in bufmgr.c,
but better safe than sorry.  Per trouble report from Kevin Grittner.
This commit is contained in:
Tom Lane
2005-10-12 16:45:14 +00:00
parent 6b97e437ca
commit 07eeb9d109
4 changed files with 64 additions and 71 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.52 2005/08/20 23:26:17 tgl Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.53 2005/10/12 16:45:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,10 +55,10 @@ bool strategy_hint_vacuum = false;
* means that we return with the BufFreelistLock still held, as well;
* the caller must release that lock once the spinlock is dropped.
*/
BufferDesc *
volatile BufferDesc *
StrategyGetBuffer(void)
{
BufferDesc *buf;
volatile BufferDesc *buf;
int trycounter;
LWLockAcquire(BufFreelistLock, LW_EXCLUSIVE);
@@ -138,7 +138,7 @@ StrategyGetBuffer(void)
* quickly the buffer is reused.
*/
void
StrategyFreeBuffer(BufferDesc *buf, bool at_head)
StrategyFreeBuffer(volatile BufferDesc *buf, bool at_head)
{
LWLockAcquire(BufFreelistLock, LW_EXCLUSIVE);