]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
RWLock: assert pthread function return values
authorSamuel Just <sam.just@inktank.com>
Sat, 9 Nov 2013 22:31:55 +0000 (14:31 -0800)
committerGreg Farnum <greg@inktank.com>
Mon, 5 May 2014 22:29:14 +0000 (15:29 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/common/RWLock.h

index f901ac0de7dfe0bfe54cf6894839782bd8651062..9fe566fb44c8b3017bdd6c7b17d750f99219d160 100644 (file)
@@ -42,13 +42,15 @@ public:
 
   void unlock() const {
     if (g_lockdep) id = lockdep_will_unlock(name, id);
-    pthread_rwlock_unlock(&L);
+    int r = pthread_rwlock_unlock(&L);
+    assert(r == 0);
   }
 
   // read
   void get_read() const {
     if (g_lockdep) id = lockdep_will_lock(name, id);
-    pthread_rwlock_rdlock(&L);
+    int r = pthread_rwlock_rdlock(&L);
+    assert(r == 0);
     if (g_lockdep) id = lockdep_locked(name, id);
   }
   bool try_get_read() const {
@@ -65,7 +67,8 @@ public:
   // write
   void get_write() {
     if (g_lockdep) id = lockdep_will_lock(name, id);
-    pthread_rwlock_wrlock(&L);
+    int r = pthread_rwlock_wrlock(&L);
+    assert(r == 0);
     if (g_lockdep) id = lockdep_locked(name, id);
   }
   bool try_get_write() {