Re: FlexLocks

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: FlexLocks
Date: 2011-11-16 17:25:15
Message-ID: 4EC39D9B020000250004305B@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:

>> Is there any way to typedef our way out of it [?]

> Well, if we just say:
>
> typedef FlexLockId LWLockId;
>
> ...that's about equivalent to the #define from the compiler's
> point of view.

Bummer -- I was hoping there was some equivalent to "subclassing"
that I just didn't know about. :-(

> We could alternatively change one or the other of them to be a
> struct with one member, but I think the cure might be worse than
> the disease. By my count, we are talking about saving perhaps as
> many as 34 lines of code changes here, and that's only if
> complicating the type handling doesn't require any changes to
> places that are untouched at present, which I suspect it would.

So I stepped through all the changes of this type, and I notice that
most of them are in areas where we've talked about likely benefits
of creating new FlexLock variants instead of staying with LWLocks;
if any of that is done (as seems likely), it further reduces the
impact from 34 lines. If we take care of LWLockHeldByMe() as you
describe, I'll concede the FlexLockId changes.

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2011-11-16 18:17:16 Re: ISN was: Core Extensions relocation
Previous Message Tom Lane 2011-11-16 17:24:02 declarations of range-vs-element <@ and @>