Thread: Refactoring lock.c

Refactoring lock.c

From
Heikki Linnakangas
Date:
Hi,

There's two almost identical pieces of code in LockRelease and
LockReleaseAll that do the opposite of GrantLock.

Here's a small patch that replaces those pieces with a static UnGrantLock
function.

This is preparation for the two-phase commit patch, since that introduces
more calls to UnGrantLock.

- Heikki

Attachment

Re: Refactoring lock.c

From
Neil Conway
Date:
On Wed, 2005-02-02 at 21:41 +0200, Heikki Linnakangas wrote:
> There's two almost identical pieces of code in LockRelease and
> LockReleaseAll that do the opposite of GrantLock.
>
> Here's a small patch that replaces those pieces with a static UnGrantLock
> function.

LockReleaseAll() did not update the holdMask bits for a released
proclock, but it will do so now. That's okay because we're removing the
proclock, right?

Barring any objections, I'll apply this to HEAD today or tomorrow.

-Neil



Re: Refactoring lock.c

From
Heikki Linnakangas
Date:
On Thu, 3 Feb 2005, Neil Conway wrote:

> On Wed, 2005-02-02 at 21:41 +0200, Heikki Linnakangas wrote:
>> There's two almost identical pieces of code in LockRelease and
>> LockReleaseAll that do the opposite of GrantLock.
>>
>> Here's a small patch that replaces those pieces with a static UnGrantLock
>> function.
>
> LockReleaseAll() did not update the holdMask bits for a released
> proclock, but it will do so now. That's okay because we're removing the
> proclock, right?

Right.

- Heikki

Re: Refactoring lock.c

From
Neil Conway
Date:
Heikki Linnakangas wrote:
> There's two almost identical pieces of code in LockRelease and
> LockReleaseAll that do the opposite of GrantLock.
>
> Here's a small patch that replaces those pieces with a static
> UnGrantLock function.

Applied to HEAD with a few trivial editorial fixes.

Thanks for the patch.

-Neil