/** * local_add_unless - add unless the number is already a given value * @l: pointer of type local_t * @a: the amount to add to l... * @u: ...unless l is equal to u. * * Atomically adds @a to @l, if @v was not already @u. * Returns true if the addition was done.
*/ static __inline__ bool
local_add_unless(local_t *l, long a, long u)
{ long c = local_read(l);
do { if (unlikely(c == u)) returnfalse;
} while (!local_try_cmpxchg(l, &c, c + a));
/* * local_sub_and_test - subtract value from variable and test result * @i: integer value to subtract * @l: pointer of type local_t * * Atomically subtracts @i from @l and returns * true if the result is zero, or false for all * other cases.
*/ #define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
/* * local_inc_and_test - increment and test * @l: pointer of type local_t * * Atomically increments @l by 1 * and returns true if the result is zero, or false for all * other cases.
*/ #define local_inc_and_test(l) (local_inc_return(l) == 0)
/* * local_dec_and_test - decrement by 1 and test * @l: pointer of type local_t * * Atomically decrements @l by 1 and * returns true if the result is 0, or false for all other * cases.
*/ #define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
/* * local_add_negative - add and test if negative * @l: pointer of type local_t * @i: integer value to add * * Atomically adds @i to @l and returns true * if the result is negative, or false when * result is greater than or equal to zero.
*/ #define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
/* Use these for per-cpu local_t variables: on some archs they are * much more efficient than these naive implementations. Note they take * a variable, not an address.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.