Re: Confusing variable naming in LWLockRelease - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Confusing variable naming in LWLockRelease
Date
Msg-id 256baafad960f39f56149d4c52be29820d1cf76d.camel@j-davis.com
Whole thread Raw
List pgsql-hackers
On Wed, 2025-01-29 at 23:16 -0800, Jacob Brazeal wrote:
> Here the variable name "oldstate" leads one to believe that the value
> is fetched before the sub operation, similar to some other usages in
> lwlock.c.

I believe it refers to the state of the lock prior to lock acquisition;
not prior to subtraction.

I agree that it's a bit confusing, because I don't think it necessarily
changes it back to the state prior to acquisition if it's a shared
lock. But the name "newstate" wouldn't be great, either.

I don't have a great name in mind, so perhaps a comment instead?

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Ilia Evdokimov
Date:
Subject: Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Next
From: Matthias van de Meent
Date:
Subject: Re: RFC: Packing the buffer lookup table