summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-06 11:36:08 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-06 11:36:08 (GMT)
commitf57395a27730cbf464b7f9293bcf058a0a481a98 (patch)
tree2dde87c696b6b9f51b1ccd39359335ae9023809f
parent6c5cdeb85dba4fd850150a6221aa26ffe82166f6 (diff)
parente75796dfa58652ec8998227d9f547eea990a0353 (diff)
downloadQt-f57395a27730cbf464b7f9293bcf058a0a481a98.zip
Qt-f57395a27730cbf464b7f9293bcf058a0a481a98.tar.gz
Qt-f57395a27730cbf464b7f9293bcf058a0a481a98.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging: Do not allow multiple threads to acquire a QMutex
-rw-r--r--src/corelib/thread/qmutex_unix.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp
index 11e2060..b584ae5 100644
--- a/src/corelib/thread/qmutex_unix.cpp
+++ b/src/corelib/thread/qmutex_unix.cpp
@@ -107,18 +107,21 @@ bool QMutexPrivate::wait(int timeout)
// lock acquired without waiting
return true;
}
- bool returnValue;
+ kern_return_t r;
if (timeout < 0) {
- returnValue = semaphore_wait(mach_semaphore) == KERN_SUCCESS;
+ do {
+ r = semaphore_wait(mach_semaphore);
+ } while (r == KERN_ABORTED);
+ if (r != KERN_SUCCESS)
+ qWarning("QMutex: infinite wait failed, error %d", r);
} else {
mach_timespec_t ts;
ts.tv_nsec = ((timeout % 1000) * 1000) * 1000;
ts.tv_sec = (timeout / 1000);
- kern_return_t r = semaphore_timedwait(mach_semaphore, ts);
- returnValue = r == KERN_SUCCESS;
+ r = semaphore_timedwait(mach_semaphore, ts);
}
contenders.deref();
- return returnValue;
+ return r == KERN_SUCCESS;
}
void QMutexPrivate::wakeUp()