Robert Haas <robertmh...@gmail.com> writes: > Well, it would certainly be easy enough to add those macros, and I'm > not necessarily opposed to it, but I fear it could end up being a bit > confusing in the long run. If we adopt this infrastructure, then I > expect knowledge of different types of FlexLocks to gradually > propagate through the system. Now, you're always going to use > LWLockAcquire() and LWLockRelease() to acquire and release an LWLock, > but a FlexLockId isn't guaranteed to be an LWLockId - any given value > might also refer to a FlexLock of some other type. If we let everyone > continue to refer to those things as LWLockIds, then it seems like > only a matter of time before someone has a variable that's declared as > LWLockId but actually doesn't refer to an LWLock at all. I think it's > better to bite the bullet and do the renaming up front, rather than > having to think about it every time you modify some code that uses > LWLockId or LWLockHeldByMe and say to yourself, "oh, wait a minute, is > this really guaranteed to be an LWLock?"
In that case, I think you've chosen an unfortunate naming convention and should rethink it. There is not any benefit to be gained from a global search and replace here, and as somebody who spends quite enough time dealing with cross-branch coding differences already, I'm going to put my foot down about introducing a useless one. Perhaps it would be better to think of this as "they're all lightweight locks, but some have different locking policies". Or "we're taking a different type of lock on this particular lock" --- that would match up rather better with the way we think about heavyweight locks. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers