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