TCPServer: do not reduce the capacity of the default ThreadPool

This commit is contained in:
Guenter Obiltschnig 2014-04-09 18:12:46 +02:00
parent f764673c61
commit fe6bf63656

View File

@ -54,10 +54,13 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port
_socket(ServerSocket(portNumber)),
_thread(threadName(_socket)),
_stopped(true)
{
{
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
if(pParams) pool.addCapacity(pParams->getMaxThreads() - pool.capacity());
if (pParams)
{
int toAdd = pParams->getMaxThreads() - pool.capacity();
if (toAdd > 0) pool.addCapacity(toAdd);
}
_pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams);
}
@ -69,7 +72,11 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke
_stopped(true)
{
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
if(pParams) pool.addCapacity(pParams->getMaxThreads() - pool.capacity());
if (pParams)
{
int toAdd = pParams->getMaxThreads() - pool.capacity();
if (toAdd > 0) pool.addCapacity(toAdd);
}
_pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams);
}