mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-02 17:50:53 +02:00
TCPServer: do not reduce the capacity of the default ThreadPool
This commit is contained in:
parent
f764673c61
commit
fe6bf63656
@ -54,10 +54,13 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port
|
|||||||
_socket(ServerSocket(portNumber)),
|
_socket(ServerSocket(portNumber)),
|
||||||
_thread(threadName(_socket)),
|
_thread(threadName(_socket)),
|
||||||
_stopped(true)
|
_stopped(true)
|
||||||
{
|
{
|
||||||
|
|
||||||
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
|
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);
|
_pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -69,7 +72,11 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke
|
|||||||
_stopped(true)
|
_stopped(true)
|
||||||
{
|
{
|
||||||
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
|
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);
|
_pDispatcher = new TCPServerDispatcher(pFactory, pool, pParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user