linux-zen-desktop/scripts/atomic/fallbacks/fetch_add_unless

11 lines
156 B
Plaintext
Raw Normal View History

2023-08-30 17:31:07 +02:00
cat << EOF
2023-10-24 12:59:35 +02:00
${int} c = raw_${atomic}_read(v);
2023-08-30 17:31:07 +02:00
do {
if (unlikely(c == u))
break;
2023-10-24 12:59:35 +02:00
} while (!raw_${atomic}_try_cmpxchg(v, &c, c + a));
2023-08-30 17:31:07 +02:00
return c;
EOF