Re: spin_lock() versus atomic_*

Stefan Monnier (monnier+lists/linux/kernel/news/@TEQUILA.SYSTEMSZ.CS.YALE.EDU)
08 Oct 1998 09:37:21 -0400


>>>>> "Paul" == Paul Barton-Davis <pbd@Op.Net> writes:
> Is there a reason to choose one of:
> spin_lock (&some_lock);
> some_counter++;
> spin_unlock (&some_lock);
> or
> atomic_inc (&some_atomic_counter);

In general, if you want to do X and there is a function that does X,
it's better to use this function than to reinvent the wheel.
This also applies to `atomic_inc', I believe,

Stefan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/