Re: [RFC] kref, a tiny, sane, reference count object

From: Nick Piggin
Date: Sat Mar 13 2004 - 22:32:45 EST

Andrew Morton wrote:

Greg KH <greg@xxxxxxxxx> wrote:

For all of those people, this patch is for you.

It does rather neatly capture a common idiom.

But as Andi said - look at all the crap involved when:

if (atomic_dec_and_test())
Also neatly captures that idiom.

And you get more flexibility by being able to use atomic_set
directly too.

But if you really like it, I agree it shouldn't allow NULL
pointers and probably get, put and cleanup should be inline.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at