Revision: 32991
http://sourceforge.net/p/opalvoip/code/32991
Author: rjongbloed
Date: 2014-10-16 11:29:05 +0000 (Thu, 16 Oct 2014)
Log Message:
-----------
Added assert for pthreads stack size not being set.
Modified Paths:
--------------
ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
===================================================================
--- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2014-10-15 14:23:19 UTC (rev 32990)
+++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2014-10-16 11:29:05 UTC (rev 32991)
@@ -256,7 +256,7 @@
PThread::PThread(bool isProcess)
: m_type(isProcess ? e_IsProcess : e_IsExternal)
- , m_originalStackSize(0) // 0 indicates external thread
+ , m_originalStackSize(0)
, m_threadId(pthread_self())
, PX_priority(NormalPriority)
#if defined(P_LINUX)
@@ -310,8 +310,6 @@
, PX_WaitSemMutex(MutexInitialiser)
#endif
{
- PAssert(m_originalStackSize > 0, PInvalidParameter);
-
#ifdef P_RTEMS
PAssertOS(socketpair(AF_INET,SOCK_STREAM,0,unblockPipe) == 0);
#else
@@ -448,11 +446,6 @@
pthread_attr_init(&threadAttr);
PAssertPTHREAD(pthread_attr_setdetachstate, (&threadAttr, PTHREAD_CREATE_DETACHED));
- if (m_originalStackSize == 0) {
- PTRACE(3, "PTlib\tUsing default stack size: " << PThreadMinimumStack);
- m_originalStackSize = PThreadMinimumStack;
- }
-
PAssertPTHREAD(pthread_attr_setstacksize, (&threadAttr, m_originalStackSize));
#if defined(P_LINUX)
@@ -469,6 +462,10 @@
PProcess & process = PProcess::Current();
+ size_t checkSize = 0;
+ PAssertPTHREAD(pthread_attr_getstacksize, (&threadAttr, &checkSize));
+ PAssert(checkSize == m_originalStackSize, "Stack size not set correctly");
+
// create the thread
PAssertPTHREAD(pthread_create, (&m_threadId, &threadAttr, &PThread::PX_ThreadMain, this));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|