]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/interruptible_future: pass lambdas to seastar::repeat as mutable,...
authorSamuel Just <sjust@redhat.com>
Mon, 18 Sep 2023 18:49:29 +0000 (11:49 -0700)
committerSamuel Just <sjust@redhat.com>
Mon, 11 Dec 2023 04:10:17 +0000 (04:10 +0000)
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 <sjust@redhat.com>
src/crimson/common/interruptible_future.h

index 857704dab378677ce19b8f5faeec9b9945c6cc4e..5f8323a66d14f497c79ee7741721180373bb0a93 100644 (file)
@@ -1212,7 +1212,7 @@ public:
            (typename Iterator::reference x) mutable {
            return call_with_interruption(
                      interrupt_condition,
-                     std::move(action),
+                     action,
                      std::forward<decltype(*begin)>(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<decltype(*begin)>(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<decltype(*begin)>(x));
          })
       );
@@ -1255,7 +1255,7 @@ public:
            (typename Iterator::reference x) mutable {
            return call_with_interruption(
                      interrupt_condition,
-                     std::move(action),
+                     action,
                      std::forward<decltype(*begin)>(x));
          })
       );
@@ -1270,10 +1270,10 @@ public:
       return make_interruptible(
          ::seastar::repeat(
            [action=std::move(action),
-           interrupt_condition=interrupt_cond<InterruptCond>.interrupt_cond] {
+           interrupt_condition=interrupt_cond<InterruptCond>.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<InterruptCond>.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<InterruptCond>.interrupt_cond] {
+           interrupt_condition=interrupt_cond<InterruptCond>.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<InterruptCond>.interrupt_cond] {
+           interrupt_condition=interrupt_cond<InterruptCond>.interrupt_cond]() mutable {
            return call_with_interruption(
                      interrupt_condition,
-                     std::move(action));
+                     action);
          })
       );
     }