From bf29f72cdf2de2ca078232a34a606b0d69ed311a Mon Sep 17 00:00:00 2001 From: karlr42 Date: Fri, 7 Mar 2014 12:22:27 +0000 Subject: [PATCH] Refinement to ThreadPool::addCapacity() usage in TCPServer --- Net/src/TCPServer.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Net/src/TCPServer.cpp b/Net/src/TCPServer.cpp index b3ce9ea52..294bea320 100644 --- a/Net/src/TCPServer.cpp +++ b/Net/src/TCPServer.cpp @@ -57,9 +57,7 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port { Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool(); - if(pParams && (pParams->getMaxThreads() > pool.capacity())){ - pool.addCapacity(pParams->getMaxThreads()); - } + if(pParams) pool.addCapacity(pParams->getMaxThreads() - pool.capacity()); _pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams); } @@ -71,9 +69,7 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke _stopped(true) { Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool(); - if(pParams && (pParams->getMaxThreads() > pool.capacity())){ - pool.addCapacity(pParams->getMaxThreads()); - } + if(pParams) pool.addCapacity(pParams->getMaxThreads() - pool.capacity()); _pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams); }