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

11 lines
164 B
Plaintext
Raw Normal View History

2023-08-30 16:31:07 +01:00
cat <<EOF
2023-10-24 11:59:35 +01:00
${int} c = raw_${atomic}_read(v);
2023-08-30 16:31:07 +01:00
do {
if (unlikely(c > 0))
return false;
2023-10-24 11:59:35 +01:00
} while (!raw_${atomic}_try_cmpxchg(v, &c, c - 1));
2023-08-30 16:31:07 +01:00
return true;
EOF