/* * 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)
static __inline__ long local_cmpxchg(local_t *l, long o, long n)
{ long t; unsignedlong flags;
powerpc_local_irq_pmu_save(flags);
t = l->v; if (t == o)
l->v = n;
powerpc_local_irq_pmu_restore(flags);
return t;
}
static __inline__ bool local_try_cmpxchg(local_t *l, long *po, long n)
{ long o = *po, r;
r = local_cmpxchg(l, o, n); if (unlikely(r != o))
*po = r;
return likely(r == o);
}
static __inline__ long local_xchg(local_t *l, long n)
{ long t; unsignedlong flags;
powerpc_local_irq_pmu_save(flags);
t = l->v;
l->v = n;
powerpc_local_irq_pmu_restore(flags);
return t;
}
/** * local_add_unless - add unless the number is already a given value * @l: pointer of type local_t * @a: the amount to add to v... * @u: ...unless v 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)
{ unsignedlong flags; bool ret = false;
powerpc_local_irq_pmu_save(flags); if (l->v != u) {
l->v += a;
ret = true;
}
powerpc_local_irq_pmu_restore(flags);
/* 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.