Revision: 21090
http://opalvoip.svn.sourceforge.net/opalvoip/?rev=21090&view=rev
Author: rjongbloed
Date: 2008-09-21 07:02:15 +0000 (Sun, 21 Sep 2008)
Log Message:
-----------
Applied patch to fix unnecesary delay when using time mutex wait and
pthread_mutex_timedlock is not available or broken, Thanks Nir Soffer
Modified Paths:
--------------
ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx
===================================================================
--- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2008-09-21 06:33:52 UTC (rev 21089)
+++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2008-09-21 07:02:15 UTC (rev 21090)
@@ -1328,7 +1328,7 @@
#else // P_PTHREADS_XPG6
- do {
+ for (;;) {
if (pthread_mutex_trylock(&mutex) == 0) {
#if P_HAS_RECURSIVE_MUTEX == 0
PAssert((lockerId == (pthread_t)-1) && (lockCount.IsZero()),
@@ -1339,11 +1339,11 @@
return PTrue;
}
+ if (PTime() >= finishTime)
+ return PFalse;
+
PThread::Current()->Sleep(10); // sleep for 10ms
- } while (PTime() < finishTime);
-
- return PFalse;
-
+ }
#endif // P_PTHREADS_XPG6
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|