From: Adam C. Emerson Date: Thu, 30 Apr 2026 00:57:35 +0000 (-0400) Subject: common/async: `io_context_pool` no longer moves from init function X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ab380f6f8435095cca2c67464c5ca6f06fee81c;p=ceph.git common/async: `io_context_pool` no longer moves from init function Previously if we received an rvalue function object we would call a moved-from object on all but the first thread. In practice this didn't cause an issue, but only because of the functions we were passing. Fixes: https://tracker.ceph.com/issues/76094 Signed-off-by: Adam C. Emerson --- diff --git a/src/common/async/context_pool.h b/src/common/async/context_pool.h index 6ec194ba77d..12993e9ccc2 100644 --- a/src/common/async/context_pool.h +++ b/src/common/async/context_pool.h @@ -18,7 +18,6 @@ #define CEPH_COMMON_ASYNC_CONTEXT_POOL_H #include -#include #include #include #include @@ -54,7 +53,7 @@ public: } template Init> io_context_pool(std::int64_t threadcnt, Init&& init) noexcept { - start(threadcnt, std::move(init)); + start(threadcnt, std::forward(init)); } ~io_context_pool() { stop(); @@ -80,8 +79,8 @@ public: ioctx.restart(); for (std::int16_t i = 0; i < threadcnt; ++i) { threadvec.emplace_back(make_named_thread("io_context_pool", - [this, init=std::move(init)] { - std::move(init)(); + [this, init] { + init(); ioctx.run(); })); }