From b1763cd33158207fda4a377e40ae2edcc5dab577 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Tue, 17 Aug 2021 00:20:02 +0800 Subject: [PATCH] crimson/common: assert the existence of interrupt_cond even in release builds Signed-off-by: Xuehan Xu --- src/crimson/common/interruptible_future.h | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/crimson/common/interruptible_future.h b/src/crimson/common/interruptible_future.h index e6c237bbc79..ce24e8ffd56 100644 --- a/src/crimson/common/interruptible_future.h +++ b/src/crimson/common/interruptible_future.h @@ -365,7 +365,7 @@ public: std::invoke_result_t>>> [[gnu::always_inline]] Result then_wrapped_interruptible(Func&& func) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); return core_type::then_wrapped( [func=std::move(func), interrupt_condition=interrupt_cond] (auto&& fut) mutable { @@ -379,7 +379,7 @@ public: template [[gnu::always_inline]] auto then_interruptible(Func&& func) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); if constexpr (std::is_void_v) { auto fut = core_type::then( [func=std::move(func), interrupt_condition=interrupt_cond] @@ -415,7 +415,7 @@ public: std::result_of_t>> [[gnu::always_inline]] Result handle_exception_interruptible(Func&& func) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); return core_type::then_wrapped( [func=std::forward(func), interrupt_condition=interrupt_cond](auto&& fut) mutable { @@ -436,7 +436,7 @@ public: [[gnu::always_inline]] Result finally_interruptible(Func&& func) { if constexpr (may_interrupt) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); return core_type::then_wrapped( [func=std::forward(func), interrupt_condition=interrupt_cond](auto&& fut) mutable { @@ -455,7 +455,7 @@ public: typename seastar::function_traits::template arg<0>::type)>>> [[gnu::always_inline]] Result handle_exception_type_interruptible(Func&& func) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); using trait = seastar::function_traits; static_assert(trait::arity == 1, "func can take only one parameter"); using ex_type = typename trait::template arg<0>::type; @@ -683,7 +683,7 @@ public: typename U = T, std::enable_if_t && interruptible, int> = 0> [[gnu::always_inline]] auto safe_then_interruptible(ValueInterruptCondT&& valfunc, ErrorVisitorT&& errfunc) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto fut = core_type::safe_then( [func=std::move(valfunc), interrupt_condition=interrupt_cond] (T&& args) mutable { @@ -719,7 +719,7 @@ public: typename U = T, std::enable_if_t && interruptible, int> = 0> [[gnu::always_inline]] auto safe_then_interruptible(ValueInterruptCondT&& valfunc, ErrorVisitorT&& errfunc) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto fut = core_type::safe_then( [func=std::move(valfunc), interrupt_condition=interrupt_cond] () mutable { @@ -754,7 +754,7 @@ public: typename U = T, std::enable_if_t && interruptible, int> = 0> [[gnu::always_inline]] auto safe_then_interruptible(ValueInterruptCondT&& valfunc) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto fut = core_type::safe_then( [func=std::move(valfunc), interrupt_condition=interrupt_cond] @@ -786,7 +786,7 @@ public: typename U = T, std::enable_if_t && interruptible, int> = 0> [[gnu::always_inline]] auto safe_then_interruptible(ValueInterruptCondT&& valfunc) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto fut = core_type::safe_then( [func=std::move(valfunc), interrupt_condition=interrupt_cond] @@ -852,7 +852,7 @@ public: template auto handle_error_interruptible(ErrorFunc&& errfunc) { if constexpr (interruptible) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto fut = core_type::handle_error( [errfunc=std::move(errfunc), interrupt_condition=interrupt_cond] @@ -885,7 +885,7 @@ public: typename... ErrorFuncTail> auto handle_error_interruptible(ErrorFuncHead&& error_func_head, ErrorFuncTail&&... error_func_tail) { - assert(interrupt_cond); + ceph_assert(interrupt_cond); static_assert(sizeof...(ErrorFuncTail) > 0); return this->handle_error_interruptible( ::crimson::composer( @@ -1355,7 +1355,7 @@ public: } static void yield() { - assert(interrupt_cond); + ceph_assert(interrupt_cond); auto interruption_condition = interrupt_cond; interrupt_cond.release(); seastar::thread::yield(); @@ -1363,7 +1363,7 @@ public: } static void maybe_yield() { - assert(interrupt_cond); + ceph_assert(interrupt_cond); if (seastar::thread::should_yield()) { auto interruption_condition = interrupt_cond; interrupt_cond.release(); -- 2.39.5