summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-22 17:27:41 -0700
committerSage Weil <sage@inktank.com>2013-07-22 17:27:41 -0700
commitcc4be1de9aa9ef17daa0cae6cc85441c8276e651 (patch)
treed7722314f941dcc0946ebcca826489850c2509b2
parentabee5b595271ade7cfad37487d3759c1442c1560 (diff)
downloadceph-cc4be1de9aa9ef17daa0cae6cc85441c8276e651.tar.gz
common/RWLock: allow lockdep to be selectively disabled
Just liked with Mutex::Lock() and friends. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/RWLock.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/common/RWLock.h b/src/common/RWLock.h
index 6fabc8c3083..fd76bd454bb 100644
--- a/src/common/RWLock.h
+++ b/src/common/RWLock.h
@@ -46,14 +46,14 @@ public:
}
// read
- void get_read() {
- if (g_lockdep) id = lockdep_will_lock(name, id);
+ void get_read(bool no_lockdep=false) {
+ if (g_lockdep && !no_lockdep) id = lockdep_will_lock(name, id);
pthread_rwlock_rdlock(&L);
- if (g_lockdep) id = lockdep_locked(name, id);
+ if (g_lockdep && !no_lockdep) id = lockdep_locked(name, id);
}
- bool try_get_read() {
+ bool try_get_read(bool no_lockdep=false) {
if (pthread_rwlock_tryrdlock(&L) == 0) {
- if (g_lockdep) id = lockdep_locked(name, id);
+ if (g_lockdep && !no_lockdep) id = lockdep_locked(name, id);
return true;
}
return false;
@@ -63,14 +63,14 @@ public:
}
// write
- void get_write() {
- if (g_lockdep) id = lockdep_will_lock(name, id);
+ void get_write(bool no_lockdep=false) {
+ if (g_lockdep && !no_lockdep) id = lockdep_will_lock(name, id);
pthread_rwlock_wrlock(&L);
- if (g_lockdep) id = lockdep_locked(name, id);
+ if (g_lockdep && !no_lockdep) id = lockdep_locked(name, id);
}
- bool try_get_write() {
+ bool try_get_write(bool no_lockdep=false) {
if (pthread_rwlock_trywrlock(&L) == 0) {
- if (g_lockdep) id = lockdep_locked(name, id);
+ if (g_lockdep && !no_lockdep) id = lockdep_locked(name, id);
return true;
}
return false;