From cf78d5cbc33cbba07d9b6f9d2479addca8134973 Mon Sep 17 00:00:00 2001 From: Eric Barr Date: Tue, 13 Mar 2012 19:30:29 -0400 Subject: [PATCH] Account for the already existing main thread of execution when spinning up threads for the thread pool. --- src/swganh/app/swganh_app.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/swganh/app/swganh_app.cc b/src/swganh/app/swganh_app.cc index 8e90d6e39..9b312d70a 100644 --- a/src/swganh/app/swganh_app.cc +++ b/src/swganh/app/swganh_app.cc @@ -156,7 +156,9 @@ void SwganhApp::Start() { boost::asio::io_service::work io_work(kernel_->GetIoService()); // Start up a threadpool for running io_service based tasks/active objects - for (uint32_t i = 0; i < boost::thread::hardware_concurrency(); ++i) { + // The increment starts at 1 because the main thread of execution already counts + // as thread in use. + for (uint32_t i = 1; i < boost::thread::hardware_concurrency(); ++i) { auto t = make_shared([this] () { kernel_->GetIoService().run(); });