Revision: 29287
http://sourceforge.net/p/opalvoip/code/29287
Author: rjongbloed
Date: 2013-03-21 03:54:37 +0000 (Thu, 21 Mar 2013)
Log Message:
-----------
Fixed printing errors that aren't really errors when checking thread is still running.
Modified Paths:
--------------
ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
===================================================================
--- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2013-03-21 01:47:08 UTC (rev 29286)
+++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2013-03-21 03:54:37 UTC (rev 29287)
@@ -791,17 +791,24 @@
return true;
int error = pthread_kill(id, 0);
- if (error == 0 || error == EPERM)
- return false;
+ switch (error) {
+ case 0 :
+ case EPERM : // Thread exists, even if we can't send signal
+ return false;
#if PTRACING
- if (error != ESRCH) {
- // Output direct to stream, do not use PTRACE as it might cause an infinite recursion.
- ostream * trace = PTrace::GetStream();
- if (trace != NULL)
- *trace << "Error " << error << " calling pthread_kill: thread=" << this << ", id=" << id << endl;
+ case ESRCH : // Thread not running any more
+ case EINVAL : // Id has never been used for a thread
+ break;
+
+ default :
+ // Output direct to stream, do not use PTRACE as it might cause an infinite recursion.
+ ostream * trace = PTrace::GetStream();
+ if (trace != NULL)
+ *trace << "Error " << error << " calling pthread_kill: thread=" << this << ", id=" << id << endl;
}
#endif
+
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|