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