Revision: 32979
http://sourceforge.net/p/opalvoip/code/32979
Author: rjongbloed
Date: 2014-10-13 10:50:58 +0000 (Mon, 13 Oct 2014)
Log Message:
-----------
Fixed bizare problem where a thread can be terminated unexpectedly. This happens only on Linux where the pthread_t id can be re-used. If it happens that the thread deleting a PThread object has the exact same, reused, pthread_t then IT gets terminated as the thread PThread instance wraps around is already gone.
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-10 11:40:42 UTC (rev 32978)
+++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2014-10-13 10:50:58 UTC (rev 32979)
@@ -790,6 +790,10 @@
if (m_originalStackSize <= 0)
return;
+ // if the thread is already terminated, then nothing to do
+ if (IsTerminated())
+ return;
+
// if thread calls Terminate on itself, then do it
// don't use PThread::Current, as the thread may already not be in the
// active threads list
@@ -798,10 +802,6 @@
return; // keeps compiler happy
}
- // if the thread is already terminated, then nothing to do
- if (IsTerminated())
- return;
-
// otherwise force thread to die
PTRACE(2, "PTLib\tForcing termination of thread id=0x" << hex << m_threadId << dec);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|