LW_SHARED_MASK macro - Mailing list pgsql-hackers

From Alexander Korotkov
Subject LW_SHARED_MASK macro
Date
Msg-id CAPpHfdsPmWqz9FB0AnxJrwp1=KLF0n=-iB+QvR0Q8GSmpFVdUQ@mail.gmail.com
Whole thread Raw
Responses Re: LW_SHARED_MASK macro
List pgsql-hackers
Hackers,

while exploring lwlock.c I found following macro to be strange.

#define LW_SHARED_MASK ((uint32)(1 << 23))

This is macro is used to extract number of shared locks from state.

ereport(LOG,
(errhidestmt(true),
errhidecontext(true),
errmsg("%d: %s(%s): excl %u shared %u haswaiters %u waiters %u rOK %d",
MyProcPid,
where, MainLWLockNames[id],
!!(state & LW_VAL_EXCLUSIVE),
state & LW_SHARED_MASK,
!!(state & LW_FLAG_HAS_WAITERS),
pg_atomic_read_u32(&lock->nwaiters),
!!(state & LW_FLAG_RELEASE_OK))));


Should it be ((uint32) ((1 << 24)-1)) instead?

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: planstate_tree_walker
Next
From: Robert Haas
Date:
Subject: Re: On-demand running query plans using auto_explain and signals