aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2016-04-14 19:26:13 -0700
committerAndres Freund <andres@anarazel.de>2016-04-14 19:26:13 -0700
commit4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5 (patch)
treed01697a882a3da65f0c3fc6c832fd3aa5c535106 /src/backend/storage/buffer/bufmgr.c
parent533cd2303aa6558721e76295fd1ffb05211764f9 (diff)
downloadpostgresql-4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5.tar.gz
postgresql-4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5.zip
Make init_spin_delay() C89 compliant #2.
My previous attempt at doing so, in 80abbeba23, was not sufficient. While that fixed the problem for bufmgr.c and lwlock.c , s_lock.c still has non-constant expressions in the struct initializer, because the file/line/function information comes from the caller of s_lock(). Give up on using a macro, and use a static inline instead. Discussion: 4369.1460435533@sss.pgh.pa.us
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 47644ea528b..462dd4a2262 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -4029,9 +4029,11 @@ rnode_comparator(const void *p1, const void *p2)
uint32
LockBufHdr(BufferDesc *desc)
{
- SpinDelayStatus delayStatus = init_local_spin_delay();
+ SpinDelayStatus delayStatus;
uint32 old_buf_state;
+ init_local_spin_delay(&delayStatus);
+
while (true)
{
/* set BM_LOCKED flag */
@@ -4055,9 +4057,11 @@ LockBufHdr(BufferDesc *desc)
static uint32
WaitBufHdrUnlocked(BufferDesc *buf)
{
- SpinDelayStatus delayStatus = init_local_spin_delay();
+ SpinDelayStatus delayStatus;
uint32 buf_state;
+ init_local_spin_delay(&delayStatus);
+
buf_state = pg_atomic_read_u32(&buf->state);
while (buf_state & BM_LOCKED)