Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
ceph_spin_unlock(&lock);
return ret;
}
- int cas(T o, T n) {
- int success = 0;
+ bool compare_and_swap(T o, T n) {
+ bool success = false;
ceph_spin_lock(&lock);
if (val == o) {
- success = 1;
+ success = true;
val = n;
}
ceph_spin_unlock(&lock);
// at some point. this hack can go away someday...
return AO_load_full((AO_t *)&val);
}
- int cas(AO_t o, AO_t n) {
+ bool compare_and_swap(AO_t o, AO_t n) {
return AO_compare_and_swap(&val, o, n);
}
void EventCenter::wakeup()
{
- if (already_wakeup.cas(0, 1)) {
+ if (already_wakeup.compare_and_swap(0, 1)) {
ldout(cct, 1) << __func__ << dendl;
char buf[1];
buf[0] = 'c';