A proposed new class, currently in 8.1. It allows for resource counting where the decrement is implicit by tieing it to the destruction of a key object that you got when incrementing.
The implementation has already been battle-tested in pgsql in 8.1.
Any suggestions related to functionality, interface and/or naming? As far as I could determine, there does not seem to be any established name for this kind of object. It's related to a semaphore, but it does things markedly different.
Because it allows me to get rid of some convoluted code in pgsql, and because it automatically solves (if any) remaining races related to asynchronous destruction of objects; I'd like to use this class in 8.0 as well (in order to keep the pgsql driver in sync between 8.0 and 8.1).
Any objections if I add this to 8.0?