From: Samuel Just Date: Mon, 18 Sep 2023 18:49:29 +0000 (-0700) Subject: crimson/common/interruptible_future: pass lambdas to seastar::repeat as mutable,... X-Git-Tag: v19.3.0~296^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=74d606549785c4073e6b6e2c599f4bfeb2002de7;p=ceph.git crimson/common/interruptible_future: pass lambdas to seastar::repeat as mutable, don't move action The lambda passed to seastar::repeat will be invoked multiple times, don't pass an rvalue ref to call_with_interruption. Also, declare lambda as mutable in case action needs to be mutable. Signed-off-by: Samuel Just --- diff --git a/src/crimson/common/interruptible_future.h b/src/crimson/common/interruptible_future.h index 857704dab37..5f8323a66d1 100644 --- a/src/crimson/common/interruptible_future.h +++ b/src/crimson/common/interruptible_future.h @@ -1212,7 +1212,7 @@ public: (typename Iterator::reference x) mutable { return call_with_interruption( interrupt_condition, - std::move(action), + action, std::forward(x)).to_future(); }) ); @@ -1224,7 +1224,7 @@ public: (typename Iterator::reference x) mutable { return call_with_interruption( interrupt_condition, - std::move(action), + action, std::forward(x)).to_future(); }) ); @@ -1243,7 +1243,7 @@ public: (typename Iterator::reference x) mutable { return call_with_interruption( interrupt_condition, - std::move(action), + action, std::forward(x)); }) ); @@ -1255,7 +1255,7 @@ public: (typename Iterator::reference x) mutable { return call_with_interruption( interrupt_condition, - std::move(action), + action, std::forward(x)); }) ); @@ -1270,10 +1270,10 @@ public: return make_interruptible( ::seastar::repeat( [action=std::move(action), - interrupt_condition=interrupt_cond.interrupt_cond] { + interrupt_condition=interrupt_cond.interrupt_cond]() mutable { return call_with_interruption( interrupt_condition, - std::move(action)).to_future(); + action).to_future(); }) ); } else { @@ -1283,7 +1283,7 @@ public: interrupt_condition=interrupt_cond.interrupt_cond]() mutable { return call_with_interruption( interrupt_condition, - std::move(action)).to_future(); + action).to_future(); }) ); } @@ -1296,20 +1296,20 @@ public: return make_interruptible( ::seastar::repeat( [action=std::move(action), - interrupt_condition=interrupt_cond.interrupt_cond] { + interrupt_condition=interrupt_cond.interrupt_cond]() mutable { return call_with_interruption( interrupt_condition, - std::move(action)); + action); }) ); } else { return make_interruptible( ::crimson::repeat( [action=std::move(action), - interrupt_condition=interrupt_cond.interrupt_cond] { + interrupt_condition=interrupt_cond.interrupt_cond]() mutable { return call_with_interruption( interrupt_condition, - std::move(action)); + action); }) ); }