tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Dynamically allocated locks

On Tue, Mar 25, 2008 at 10:39:43AM -0700, Jason Thorpe wrote:
 >> This is not really an objection... but are we committed going forward
 >> to the names "hold" and "free" for refcounting as opposed to, say,
 >> "incref" and "decref"?
 > I'm a big fan of "retain" and "release" myself :-)

If you'll allow me to be pedantic for a moment... those are
semantically comparable to "hold" and "free". The reason to prefer
"incref" and "decref" is that those names say what *they* do when you
call them, rather than what *you* do when you call them.

The problem with functions that say what *you* do when you call them
is that in general someone else wrote them(*); so you have to guess
whether what you think you're doing is really what that person
expected you to be doing, or if it's subtly different in some way.

This is a pretty fine point and I'm not sure I've grasped it more than
instinctively until this very moment. But I think it's real, and
potentially pretty important.

(*) ...including you yourself more than a few weeks ago.

David A. Holland

Home | Main Index | Thread Index | Old Index