summaryrefslogtreecommitdiffstats
path: root/scripts/atomic/fallbacks/try_cmpxchg
blob: c7a26213b97820466edfdf76f6fe700bc069550c (plain)
1
2
3
4
5
6
7
8
9
10
11
cat <<EOF
static __always_inline bool
${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)
{
	${int} r, o = *old;
	r = ${atomic}_cmpxchg${order}(v, o, new);
	if (unlikely(r != o))
		*old = r;
	return likely(r == o);
}
EOF