add helpers for supporting `ceph_mutex_is_locked()` and
`ceph_mutex_is_wlocked()` macros
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
cc67c34a9e5b32e9372f6e109549619def3b6bc4)
return true;
}
void unlock() {}
+ void lock_shared() {}
+ void unlock_shared() {}
};
using mutex = dummy_mutex;
// debug methods
#define ceph_mutex_is_locked(m) ((m).is_locked())
+ #define ceph_mutex_is_wlocked(m) ((m).is_wlocked())
#define ceph_mutex_is_locked_by_me(m) ((m).is_locked_by_me())
}
void lock();
bool try_lock();
void unlock();
+ bool is_wlocked() const {
+ return nlock > 0;
+ }
// shared locking
void lock_shared();
bool try_lock_shared();
void unlock_shared();
+ // either of them
+ bool is_locked() const {
+ return nlock > 0 || nrlock > 0;
+ }
private:
// exclusive locking
void _pre_unlock();