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

11 lines
164 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 > 0))
return false;
2023-10-24 12:59:35 +02:00
} while (!raw_${atomic}_try_cmpxchg(v, &c, c - 1));
2023-08-30 17:31:07 +02:00
return true;
EOF