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

Nick Piggin
2004-03-14T03:31:09Z

Andrew Morton wrote:

>Greg KH <greg@kroah.com> 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:

atomic_inc();
if (atomic_dec_and_test())
release();
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.