Sign in
android-kvm
/
linux
/
2b008dc6926c2df04530d9ddca6fa22f339d92b9
/
.
/
scripts
/
atomic
/
fallbacks
/
try_cmpxchg
blob: 4ed85e2f5378187256ece298e53dba0c433bc947 [
file
] [
log
] [
blame
]
cat
<<
EOF
static
inline
bool
$
{
atomic
}
_try_cmpxchg$
{
order
}(
$
{
atomic
}
_t
*
v
,
$
{
int
}
*
old
,
$
{
int
}
new
)
{
$
{
int
}
r
,
o
=
*
old
;
r
=
$
{
atomic
}
_cmpxchg$
{
order
}(
v
,
o
,
new
);
if
(
unlikely
(
r
!=
o
))
*
old
=
r
;
return
likely
(
r
==
o
);
}
EOF