Messages in this thread | | | Date | Fri, 17 Nov 2000 12:24:33 +0100 | From | Ingo Oeser <> | Subject | Re: [PATCH (2.4)] atomic use count for proc_dir_entry |
| |
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 majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
| |