]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ceph_mutex: add dummy mutex for WITH_SEASTAR
authorKefu Chai <kchai@redhat.com>
Tue, 25 Sep 2018 07:44:43 +0000 (15:44 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 25 Sep 2018 12:09:04 +0000 (20:09 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/ceph_mutex.h

index 3c105ef7a62295059ae281566d2f9ebc0095292f..00eb3c72588f8445e5d1d17fadf9eb61017c5a01 100644 (file)
 // The key requirement is that you make use of the ceph::make_mutex()
 // and make_recursive_mutex() factory methods, which take a string
 // naming the mutex for the purposes of the lockdep debug variant.
+
+#ifdef WITH_SEASTAR
+
+namespace ceph {
+  // an empty class satisfying the mutex concept
+  struct dummy_mutex {
+    void lock() {}
+    bool try_lock() {
+      return true;
+    }
+    void unlock() {}
+  };
+
+  using mutex = dummy_mutex;
+  using recursive_mutex = dummy_mutex;
+  // in seastar, we should use a difference interface for enforcing the
+  // semantics of condition_variable
+
+  template <typename ...Args>
+  dummy_mutex make_mutex(Args&& ...args) {
+    return {};
+  }
+
+  template <typename ...Args>
+  recursive_mutex make_recursive_mutex(Args&& ...args) {
+    return {};
+  }
+
+  #define ceph_mutex_is_locked(m) true
+  #define ceph_mutex_is_locked_by_me(m) true
+}
+
+#else  // WITH_SEASTAR
 //
 // For legacy Mutex users that passed recursive=true, use
 // ceph::make_recursive_mutex.  For legacy Mutex users that passed
@@ -78,4 +111,6 @@ namespace ceph {
   #define ceph_mutex_is_locked_by_me(m) true
 }
 
-#endif
+#endif // CEPH_DEBUG_MUTEX
+
+#endif // WITH_SEASTAR