git.samba.org
/
sfrench
/
cifs-2.6.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Merge branch 'locking/atomics' into locking/core, to pick up WIP commits
[sfrench/cifs-2.6.git]
/
scripts
/
atomic
/
fallbacks
/
dec_if_positive
1
cat <<EOF
2
static inline ${ret}
3
${atomic}_dec_if_positive(${atomic}_t *v)
4
{
5
${int} dec, c = ${atomic}_read(v);
6
7
do {
8
dec = c - 1;
9
if (unlikely(dec < 0))
10
break;
11
} while (!${atomic}_try_cmpxchg(v, &c, dec));
12
13
return dec;
14
}
15
EOF