summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-26 23:42:28 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-26 23:42:28 (GMT)
commit59c58576efd3ceff7add46a359fd99e56a2fb279 (patch)
treea23982655f3f7959c9c340b429aebc51435e6676 /src/corelib
parentd8f757bdb881c3a3d723642734d7d76fae14dce7 (diff)
parent1a72f98a15ef78004894dc6636b8a5d969d66fde (diff)
downloadQt-59c58576efd3ceff7add46a359fd99e56a2fb279.zip
Qt-59c58576efd3ceff7add46a359fd99e56a2fb279.tar.gz
Qt-59c58576efd3ceff7add46a359fd99e56a2fb279.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fixed copy-paste error in htmlgenerator.cpp Corrected filename case for wincrypt.h Add qDebug() operator for QGLFormat Fix conversion between JavaScript Date and QDateTime Avoid memory allocation when converting from Gbk to unicode. Warn if surface creation fails Doc: fixing search bug doc: Added more DITA output to the XML generator QSemaphore::tryAquire(timeout) -- never times out on an active semaphore Fix warnings in QSslSocketPrivate::systemCaCertificates() doc: Added more DITA output to the XML generator
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/thread/qsemaphore.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 9dc828d..8e8a88a 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -44,6 +44,8 @@
#ifndef QT_NO_THREAD
#include "qmutex.h"
#include "qwaitcondition.h"
+#include "qelapsedtimer.h"
+#include "qdatetime.h"
QT_BEGIN_NAMESPACE
@@ -218,8 +220,11 @@ bool QSemaphore::tryAcquire(int n, int timeout)
while (n > d->avail)
d->cond.wait(locker.mutex());
} else {
+ QElapsedTimer timer;
+ timer.start();
while (n > d->avail) {
- if (!d->cond.wait(locker.mutex(), timeout))
+ if (timer.hasExpired(timeout)
+ || !d->cond.wait(locker.mutex(), timeout - timer.elapsed()))
return false;
}
}