summaryrefslogtreecommitdiffstats
path: root/scripts/atomic/fallbacks/try_cmpxchg
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/atomic/fallbacks/try_cmpxchg')
-rwxr-xr-xscripts/atomic/fallbacks/try_cmpxchg7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/atomic/fallbacks/try_cmpxchg b/scripts/atomic/fallbacks/try_cmpxchg
new file mode 100755
index 0000000000..d4da82092b
--- /dev/null
+++ b/scripts/atomic/fallbacks/try_cmpxchg
@@ -0,0 +1,7 @@
+cat <<EOF
+ ${int} r, o = *old;
+ r = raw_${atomic}_cmpxchg${order}(v, o, new);
+ if (unlikely(r != o))
+ *old = r;
+ return likely(r == o);
+EOF