try_cmpxchg 501 B

12345678910111213141516
  1. cat <<EOF
  2. /**
  3. * ${class}${atomicname}() - atomic compare and exchange with ${desc_order} ordering
  4. * @v: pointer to ${atomic}_t
  5. * @old: pointer to ${int} value to compare with
  6. * @new: ${int} value to assign
  7. *
  8. * If (@v == @old), atomically updates @v to @new with ${desc_order} ordering.
  9. * Otherwise, @v is not modified, @old is updated to the current value of @v,
  10. * and relaxed ordering is provided.
  11. *
  12. * ${desc_noinstr}
  13. *
  14. * Return: @true if the exchange occurred, @false otherwise.
  15. */
  16. EOF