From: Kefu Chai Date: Tue, 25 Sep 2018 07:44:43 +0000 (+0800) Subject: common/ceph_mutex: add dummy mutex for WITH_SEASTAR X-Git-Tag: v14.0.1~155^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bb9158debbe8ac647e30bb15a250aa665ec60952;p=ceph.git common/ceph_mutex: add dummy mutex for WITH_SEASTAR Signed-off-by: Kefu Chai --- diff --git a/src/common/ceph_mutex.h b/src/common/ceph_mutex.h index 3c105ef7a6229..00eb3c72588f8 100644 --- a/src/common/ceph_mutex.h +++ b/src/common/ceph_mutex.h @@ -10,6 +10,39 @@ // 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 + dummy_mutex make_mutex(Args&& ...args) { + return {}; + } + + template + 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