-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
http://pocoproject.org/forum/viewtopic.php?f=12&t=5760
by rd » Thu Feb 07, 2013 5:43 am
Hi,
It seems to me there is a problem when using a Poco::Thread on linux when you do not call join() on it and the thread function simply finishes before the Thread object destructor is called.
The destructor only calls pthread_detach() if isRunningImpl() is true, but if the ThreadImpl::runnableEntry(void* pThread) function finishes, it will set pData->pRunnableTarget = 0, so isRunningImpl() will return false then.
This causes the virtual memory usage of the process to increase with every thread, an after a few hundred started&stopped threads you will get "cannot start thread" exceptions.
Thread_POSIX.cpp:
ThreadImpl::~ThreadImpl()
{
if (isRunningImpl())
pthread_detach(_pData->thread);
}Reactions are currently unavailable