From f897a8b26a8ae26836871bf2d35cda02531d702a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 24 Feb 2021 12:33:33 +0800 Subject: [PATCH] async/PosixStack: do not reference worker id in ctor as it's not needed and confusing. Signed-off-by: Kefu Chai (cherry picked from commit 892bfa097eaf3e1e83cb3fa2ab4b0161bf987851) --- src/msg/async/PosixStack.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/msg/async/PosixStack.h b/src/msg/async/PosixStack.h index a7e2f249cafe5..fba45c06bd6f4 100644 --- a/src/msg/async/PosixStack.h +++ b/src/msg/async/PosixStack.h @@ -48,8 +48,7 @@ class PosixNetworkStack : public NetworkStack { explicit PosixNetworkStack(CephContext *c); void spawn_worker(unsigned i, std::function &&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()); -- 2.39.5