On Fri, Nov 17, 2000 at 12:35:03AM -0800, Jacob Luna Lundberg wrote:
> > atomic_dec_and_test() returns true.
>
> Indeed, after studying the asm in question I think I see how it ticks.
> What is the reasoning behind reversing the result of the test instead of
> returning the new value of the counter?
The full name of this operation is: "Decrement the value given
and test the result for equality with zero in one atomic operation".
So basically:
#define dec_and_test(i) ( (--i) ? 0 : 1)
but atomically.
This is implemented in hardware for some archs and a required
operation for proper and fast refcounting.
Regards
Ingo Oeser
--
To the systems programmer, users and applications
serve only to provide a test load.
<esc>:x
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/