Re: Assert(LWLockHeldByMeInMode(lock, LW_EXCLUSIVE))

From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert(LWLockHeldByMeInMode(lock, LW_EXCLUSIVE))
Date: 2016-09-05 09:55:36
Message-ID: 7e5aad6f-ef9a-3d3a-7dc6-bc2e43aa0517@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20/06/2016 06:28, Thomas Munro wrote:
> On Mon, Jun 20, 2016 at 3:43 PM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
>> On 18 June 2016 at 11:28, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
>> wrote:
>>> Several times now when reading, debugging and writing code I've wished
>>> that LWLockHeldByMe assertions specified the expected mode, especially
>>> where exclusive locking is required.
>>>
>>> What do you think about something like the attached? See also an
>>> example of use. I will add this to the next commitfest.
>>
>> I've wanted this before too [...]
>

same here.

> Before ab5194e6f (25 December 2014) held_lwlocks didn't record the mode.
>

I just reviewed both patches. They applies cleanly on current HEAD,
work as intended and make check run smoothly. Patches are pretty
straightforward, so I don't have much to say.

My only remark is on following comment:

+ * LWLockHeldByMeInMode - test whether my process holds a lock in mode X

Maybe something like "test whether my process holds a lock in given
mode" would be better?

Otherwise, I think they're ready for committer.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2016-09-05 10:00:28 Re: Assert(LWLockHeldByMeInMode(lock, LW_EXCLUSIVE))
Previous Message Amit Kapila 2016-09-05 09:47:18 Re: condition variables