From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: LW_SHARED_MASK macro |
Date: | 2015-09-17 14:38:30 |
Message-ID: | 20150917143830.GP2086@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2015-09-17 14:35:20 +0300, Alexander Korotkov wrote:
> 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?
Argh, that's somewhat embarassing. You're absolutely right. Luckily it's
only used for LOCK_DEBUG, but still...
Andres
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2015-09-17 14:46:55 | Re: On-demand running query plans using auto_explain and signals |
Previous Message | Pavel Stehule | 2015-09-17 14:37:06 | Re: On-demand running query plans using auto_explain and signals |