]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
async/PosixStack: do not reference worker id in ctor
authorKefu Chai <kchai@redhat.com>
Wed, 24 Feb 2021 04:33:33 +0000 (12:33 +0800)
committeryite.gu <yitegu0@gmail.com>
Sun, 4 Feb 2024 03:21:30 +0000 (11:21 +0800)
as it's not needed and confusing.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 892bfa097eaf3e1e83cb3fa2ab4b0161bf987851)

src/msg/async/PosixStack.h

index a7e2f249cafe54893bb71eab2a3d963d6ca0ae49..fba45c06bd6f40cb2a357407af089e4f76684f77 100644 (file)
@@ -48,8 +48,7 @@ class PosixNetworkStack : public NetworkStack {
   explicit PosixNetworkStack(CephContext *c);
 
   void spawn_worker(unsigned i, std::function<void ()> &&func) override {
-    threads.resize(i+1);
-    threads[i] = std::thread(func);
+    threads.emplace_back(std::move(func));
   }
   void join_worker(unsigned i) override {
     ceph_assert(threads.size() > i && threads[i].joinable());