mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-18 11:39:00 +02:00

committed by
Aleksandar Fabijanic

parent
bc5a49c320
commit
92f963b858
@@ -96,7 +96,7 @@ void TCPServerDispatcher::release()
|
|||||||
|
|
||||||
void TCPServerDispatcher::run()
|
void TCPServerDispatcher::run()
|
||||||
{
|
{
|
||||||
AutoPtr<TCPServerDispatcher> guard(this, true); // ensure object stays alive
|
AutoPtr<TCPServerDispatcher> guard(this); // ensure _rc is decreased when function exits; it was incremented in enqueue()
|
||||||
|
|
||||||
int idleTime = (int) _pParams->getThreadIdleTime().totalMilliseconds();
|
int idleTime = (int) _pParams->getThreadIdleTime().totalMilliseconds();
|
||||||
|
|
||||||
@@ -149,6 +149,10 @@ void TCPServerDispatcher::enqueue(const StreamSocket& socket)
|
|||||||
{
|
{
|
||||||
_threadPool.startWithPriority(_pParams->getThreadPriority(), *this, threadName);
|
_threadPool.startWithPriority(_pParams->getThreadPriority(), *this, threadName);
|
||||||
++_currentThreads;
|
++_currentThreads;
|
||||||
|
// Ensure this object lives at least until run() starts
|
||||||
|
// Small chance of leaking if threadpool is stopped before this
|
||||||
|
// work runs, but better than a dangling pointer and crash!
|
||||||
|
++_rc;
|
||||||
}
|
}
|
||||||
catch (Poco::Exception&)
|
catch (Poco::Exception&)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user